next up previous contents index
Next: 5.6 oskit_posixio: POSIX I/O Up: 5.5 oskit_netio: Network packet Previous: 5.5 oskit_netio: Network packet

5.5.1 push: Push a packet through to the packet consumer

 

SYNOPSIS

#include <oskit/io/netio.h>

OSKIT_COMDECL push(oskit_netio_t *io, oskit_bufio *buf, oskit_size_t size);

DESCRIPTION

This method feeds a network packet to the packet consumer represented by the netio object; what the consumer does with the packet depends entirely on who the consumer is and how it is configured. The packet is contained in a bufio object which must be at least the size of the packet, but may be larger; the size parameter on the push call indicates the actual size of the packet.

If the consumer needs to hold on to the provided bufio object after returning from the call, it must call addref on the bufio object to obtain its own reference; then it must release this reference at some later time when it is done with the buffer. Otherwise, if the consumer doesn't obtain its own reference, the caller may recycle the buffer as soon as the call returns.

The passed buffer object is logically read-only; the consumer must not attempt to write to it. The size parameter to this call is the actual size of the packet; the size of the buffer, as returned by the getsize method, may be larger than the size of the packet.

PARAMETERS

io
The oskit_netio interface representing the packet consumer.
buf
The oskit_bufio interface to the buffer object containing the packet.
size
The actual size of the packet; must be less than or equal to the size of the buffer object.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.



University of Utah Flux Research Group