-
Notifications
You must be signed in to change notification settings - Fork 81
GOON Network 1.5: Ported Datagram Protocol #1397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
francinum
wants to merge
20
commits into
DaedalusDock:master
Choose a base branch
from
francinum:pdp_ported_datagram_protocol
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b3ebfca
AGONY
francinum fd91f7b
I think this is mostly done????
francinum 4f8f54e
PASS CHECKS YOU CHEAP KAZAKH WHORE
francinum 1675c7c
Merge branch 'master' of github.com:DaedalusDock/Daedalusdock into pd…
francinum 08bb623
update documentation, add a v2 helper.
Kapu1178 65ee145
This can just be there
Kapu1178 3e51d13
add legacy aliases for old code
Kapu1178 7c56ff9
fix runtime
Kapu1178 d9e1894
Merge branch 'master' of github.com:DaedalusDock/daedalusdock into pd…
Kapu1178 048da0f
Merge branch 'master' of github.com:DaedalusDock/daedalusdock into pd…
Kapu1178 238db43
Defines and cleanups/Port freeing support
francinum f78ec67
fixes + basic netpage
Kapu1178 90abd5e
reduce help command boilerplate by 98%
Kapu1178 b5f47d0
add netprobe help
Kapu1178 1e96a05
minor bug fix
Kapu1178 01a33ce
Merge branch 'master' into pdp_ported_datagram_protocol
francinum b334146
Merge branch 'master' into pdp_ported_datagram_protocol
francinum 4137bd4
Fix linter
francinum 99050dc
Merge branch 'master' of github.com:DaedalusDock/Daedalusdock into pd…
francinum e595281
whoops missed a key usage of these defines
francinum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /* | ||
| * Ported Datagram Protocol Socket | ||
| */ | ||
|
|
||
| #define PDP_SOCKET_QUEUE_DEPTH 50 | ||
| /// 'Real' insert position, subject to BYOND Listism. | ||
| #define PDP_S_HEAD_REAL (head_pointer+1) | ||
| /// 'Real' read position, subject to BYOND Listism. | ||
| #define PDP_S_TAIL_REAL (tail_pointer+1) | ||
|
|
||
| #if PDP_SOCKET_QUEUE_DEPTH < 3 | ||
| #error PDP_SOCKET_QUEUE_DEPTH is too short. If you trigger this, good fucking job:tm: | ||
| #endif | ||
|
|
||
| /datum/pdp_socket | ||
| /// Next Hop datum we send our packets to, Usually an operating system, but may be a physical network device. | ||
| var/datum/outgoing_datum | ||
| /// 'Owner' that registered for this socket. Used to assure ownership. | ||
| var/datum/owner | ||
| /// PDP Port the socket is bound to, Packets being sent out of this socket will have their source port set to this. | ||
| var/bound_port | ||
|
|
||
|
|
||
| /// Packet ring buffer | ||
| VAR_PRIVATE/list/packet_buffer | ||
| /// Insertion point, Incremented on packet receive. Will drop instead if =tail_pointer-1 | ||
| /// Do not use directly, Must add 1 to account for list jank | ||
| VAR_PRIVATE/head_pointer | ||
| /// Read pointer, Incremented on packet read, Will not increment if there is no packet to read. | ||
| VAR_PRIVATE/tail_pointer | ||
|
|
||
| /datum/pdp_socket/New(bound_port, outgoing_datum, owner) | ||
| if(!bound_port) | ||
| stack_trace("Created a PDP socket without a port number?") | ||
|
|
||
| src.bound_port = bound_port | ||
| src.outgoing_datum = outgoing_datum | ||
| src.owner = owner | ||
| packet_buffer = new /list(PDP_SOCKET_QUEUE_DEPTH) | ||
| head_pointer = 0 | ||
| tail_pointer = 0 | ||
|
|
||
| /// Place received packet into ringqueue. Returns TRUE if inserted, FALSE if dropped due to full queue. | ||
| // No lohi I am not implimenting DSCP. Right now, at least. Maybe later. | ||
| /datum/pdp_socket/proc/enqueue(datum/signal/packet) | ||
| if(((head_pointer + 1) % PDP_SOCKET_QUEUE_DEPTH) == tail_pointer) | ||
| return FALSE //Ring full, Drop the packet. | ||
| packet_buffer[PDP_S_HEAD_REAL] = packet | ||
| head_pointer = (head_pointer+1) % PDP_SOCKET_QUEUE_DEPTH | ||
| return TRUE | ||
|
|
||
| /// Get next signal in queue, or null if queue is dry. | ||
| /datum/pdp_socket/proc/pop() | ||
| . = packet_buffer[PDP_S_TAIL_REAL] | ||
| if(!.) | ||
| return null | ||
| tail_pointer = (tail_pointer+1) % PDP_SOCKET_QUEUE_DEPTH | ||
| //return . | ||
|
|
||
| #undef PDP_SOCKET_QUEUE_DEPTH | ||
| #undef PDP_S_HEAD_REAL | ||
| #undef PDP_S_TAIL_REAL | ||
|
|
||
| /// Send a PDP payload packet to the destionation port and address. | ||
| /datum/pdp_socket/proc/send_data(d_address, d_port, list/payload) | ||
| // Packets come out of this preeetty skeletonized, Higher layers above this are expected to fill out some remaining details | ||
| // Such as source address. | ||
|
|
||
| var/list/packet_data = list( | ||
| PACKET_ARG_PROTOCOL = PACKET_ARG_PROTOCOL_PDP, | ||
|
|
||
| PDP_DESTINATION_ADDRESS = d_address, | ||
| PDP_DESTINATION_PORT = d_port, | ||
|
|
||
| //Source address set at NIC | ||
| PDP_SOURCE_PORT = bound_port, | ||
|
|
||
| PDP_PAYLOAD_DATA = payload | ||
| ) | ||
|
|
||
| var/datum/signal/packet = new(null, packet_data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
237 changes: 0 additions & 237 deletions
237
code/modules/computer4/data/terminal/operating_system.dm
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.