Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
Functions
Raw Packets

Send and receive raw packets. More...

Functions

devcall rawClose (device *devptr)
 
devcall rawControl (device *devptr, int func, long arg1, long arg2)
 
struct raw * rawDemux (struct netaddr *src, struct netaddr *dst, ushort proto)
 
devcall rawInit (device *devptr)
 
devcall rawOpen (device *devptr, va_list ap)
 
devcall rawRead (device *devptr, void *buf, uint len)
 
syscall rawRecv (struct packet *pkt, struct netaddr *src, struct netaddr *dst, ushort proto)
 
syscall rawSend (struct raw *rawptr, void *buf, uint len)
 
devcall rawWrite (device *devptr, void *buf, uint len)
 

Detailed Description

Send and receive raw packets.

Function Documentation

devcall rawClose ( device *  devptr)

Close a raw socket device.

Parameters
devptrRAW device table entry
Returns
OK if raw socket is closed properly, otherwise SYSERR
devcall rawControl ( device *  devptr,
int  func,
long  arg1,
long  arg2 
)

Control function for raw sockets.

Parameters
devptrRAW device table entry
funccontrol function to execute
arg1first argument for the control function
arg2second argument for the control function
Returns
the result of the control function
struct raw* rawDemux ( struct netaddr *  src,
struct netaddr *  dst,
ushort  proto 
)

Locate the raw socket for a packet

Parameters
srcsource IP address of the packet
dstdestination IP address of the packet
protoprotocol of the packet
Returns
most completely matched socket, NULL if no match
devcall rawInit ( device *  devptr)

Initialize raw socket structures.

Parameters
devptrRAW device table entry
Returns
OK if device is initialized
devcall rawOpen ( device *  devptr,
va_list  ap 
)

Open a raw socket.

Parameters
devptrRAW device table entry
ap2nd argument is the local IP address 3rd argument is the remote IP address 4th argument is the IP protocol
Returns
OK if raw socket is opened properly, otherwise SYSERR
devcall rawRead ( device *  devptr,
void *  buf,
uint  len 
)

Read a packet from a raw socket.

Parameters
devptrpointer to RAW device
bufbuffer for read packet
lensize of the buffer
Returns
number of octets read, SYSERR if error occurred
syscall rawRecv ( struct packet *  pkt,
struct netaddr *  src,
struct netaddr *  dst,
ushort  proto 
)

Process an incoming protocol other than UDP or TCP.

Parameters
pktpointer to the incoming packet
Returns
OK if packet was processed succesfully, otherwise SYSERR
syscall rawSend ( struct raw *  rawptr,
void *  buf,
uint  len 
)

Send an outgoing packet of protocol other than UDP or TCP.

Parameters
rawptrpointer to the raw socket control block
bufbuffer to semd
lensize of the buffer
Returns
OK if packet was sent succesfully, otherwise SYSERR
devcall rawWrite ( device *  devptr,
void *  buf,
uint  len 
)

Write a packet to a raw socket.

Parameters
devptrpointer to RAW device
bufbuffer to write
lensize of the buffer
Returns
number of octets written, SYSERR if error occurred