read/write packet buffer macros

read and write to packet buffers

C Specification

void writeByte(NLbyte *buffer, NLint count, NLbyte value)

void writeShort(NLbyte *buffer, NLint count, NLushort value)

void writeLong(NLbyte *buffer, NLint count, NLulong value)

void writeFloat(NLbyte *buffer, NLint count, NLfloat value)

void writeDouble(NLbyte *buffer, NLint count, NLdouble value)

void writeString(NLbyte *buffer, NLint count, NLbyte *value)

void writeBlock(NLbyte *buffer, NLint count, NLbyte *value, NLint length)

void readByte(NLbyte *buffer, NLint count, NLbyte value)

void readShort(NLbyte *buffer, NLint count, NLushort value)

void readLong(NLbyte *buffer, NLint count, NLulong value)

void readFloat(NLbyte *buffer, NLint count, NLfloat value)

void readDouble(NLbyte *buffer, NLint count, NLdouble value)

void readString(NLbyte *buffer, NLint count, NLbyte *value)

void readBlock(NLbyte *buffer, NLint count, NLbyte *value, NLint length)

Parameters

buffer

[out/in]Specifies the packet buffer.

count

[out/in]Specifies the counter that points into the packet buffer.

value

[out/in]Specifies the value to be written or read.

length

[in]Specifies the length of the value (Blocks only).

Description

These macros allow easy access to a packet buffer. They also endian swap the values as needed. These are almost all implemented as macros, so care must be taken when passing values to them.

count keeps track of the current read/write location inside of buffer. It MUST be initialized to 0 before reading from or writing to the buffer. It is incremented after each read and write by the length of the value.

Note: If you are compiling on a platform that does not allow non-aligned memory access, define NL_SAFE_COPY to safely access memory. This is slower, so only define it if you need it.

Return values

none

Error codes

none

See also

nlSwap


Back to the HawkNL index page


Go directly to the main HawkNL page at Hawk Software

© 2000-2002 Phil Frisbie.

Valid XHTML 1.0!