57 buf1.
skip<
short int>();
62 buf1 = buf.
after<
short int>();
Buffer whose starting can be moved back and forth, useful to decapsulate stacked network packets.
Definition: netbuffer.h:36
void skip()
Move the starting point of this buffer sizeof(T) bytes from the beginning.
Definition: netbuffer.h:144
size_t size() const
Return the buffer size.
Definition: netbuffer.h:77
const T * cast(size_t ofs=0) const
Access the buffer contents as a structure T at the given offset.
Definition: netbuffer.h:93
const void * data(size_t ofs=0) const
Return a pointer to the buffer.
Definition: netbuffer.h:71
const NetBuffer after(size_t ofs) const
Return another NetBuffer starting ofs bytes from the beginning of this one.
Definition: netbuffer.h:111
bool fits(size_t ofs=0) const
Check if the buffer is long enough to contain a structure T at the given offset.
Definition: netbuffer.h:84
Definition: buffer.cpp:28
Definition: netbuffer.test.h:12
Test startAtBeginning()
Definition: netbuffer.test.h:15
Test skipBytes()
Definition: netbuffer.test.h:27
void Test
Definition: test.h:178
#define assert_eq(x, y)
Definition: test.h:33
#define assert(x)
Definition: test.h:30