Embedded Xinu Operating System
An ongoing research project and educational operating system.
|
Low-level functions mostly internal to the UDP driver. More...
Functions | |
ushort | udpChksum (struct packet *pkt, ushort len, const struct netaddr *src, const struct netaddr *dst) |
struct udp * | udpDemux (ushort dstpt, ushort srcpt, const struct netaddr *dstip, const struct netaddr *srcip) |
syscall | udpFreebuf (struct udpPkt *udppkt) |
struct udpPkt * | udpGetbuf (struct udp *udpptr) |
syscall | udpRecv (struct packet *pkt, const struct netaddr *src, const struct netaddr *dst) |
syscall | udpSend (struct udp *udpptr, ushort datalen, const void *buf) |
Low-level functions mostly internal to the UDP driver.
ushort udpChksum | ( | struct packet * | pkt, |
ushort | len, | ||
const struct netaddr * | src, | ||
const struct netaddr * | dst | ||
) |
Calculate the checksum of a UDP packet based on UDP and IP information
udppkt | UDP packet to calculate checksum for |
len | Length of UDP packet |
src | Source IP Address |
dst | Destination IP Address |
struct udp* udpDemux | ( | ushort | dstpt, |
ushort | srcpt, | ||
const struct netaddr * | dstip, | ||
const struct netaddr * | srcip | ||
) |
Locate the UDP socket for a UDP packet
dstpt | destination port of the UDP packet |
srcpt | source port of the UDP packet |
dstip | destination IP of the UDP packet |
srcip | source IP of the UDP packet |
syscall udpRecv | ( | struct packet * | pkt, |
const struct netaddr * | src, | ||
const struct netaddr * | dst | ||
) |
Receive a UDP packet and place it in the UDP device's input buffer
pkt | Incoming UDP packet |
src | Source address |
dst | Destination address |
syscall udpSend | ( | struct udp * | udpptr, |
ushort | datalen, | ||
const void * | buf | ||
) |
Send a UDP packet through a UDP device, thereby sending it over the network with the address/port parameters with which the UDP device is configured.
This function is intended to be internal to the UDP code. From external code use write(), which calls udpWrite().
Note: depending on the lower levels of the network stack, this function likely only buffers the packet to be sent at some later time. Therefore, it may not have actually been transmitted on the wire when this function returns.
The UDP device MUST be open and MUST remain open throughout the execution of this function.
udpptr | Pointer to the control block for the UDP device. |
datalen | Number of bytes of data to send, which must be a valid value for the current UDP device mode (e.g. if in passive mode, it must be at least the length of the UDP pseudo-header plus UDP header). |
buf | Buffer of data to send. In the default mode, this will interpreted as the UDP payload; however, if the UDP device is in passive mode, this will interpreted as the UDP pseudo-header follewed by the UDP header followed by the UDP payload. |