Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

byte_extract.c File Reference

#include <sys/types.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include "bounds.h"
#include "byte_extract.h"
#include "debug.h"

Go to the source code of this file.

Defines

#define TEXTLEN   (PARSELEN + 1)

Functions

int byte_extract (int endianess, int bytes_to_grab, u_int8_t *ptr, u_int8_t *start, u_int8_t *end, u_int32_t *value)
int string_extract (int bytes_to_grab, int base, u_int8_t *ptr, u_int8_t *start, u_int8_t *end, u_int32_t *value)


Define Documentation

#define TEXTLEN   (PARSELEN + 1)
 

Definition at line 35 of file byte_extract.c.

Referenced by string_extract().


Function Documentation

int byte_extract int  endianess,
int  bytes_to_grab,
u_int8_t ptr,
u_int8_t start,
u_int8_t end,
u_int32_t value
 

Grab a binary representation of data from a buffer

This method will read either a big or little endian value in binary data from the packet and return an u_int32_t value.

Parameters:
endianess value to read the byte as
bytes_to_grab how many bytes should we grab from the packet
data pointer to where to grab the data from
start pointer to start range of buffer
end pointer to end range of buffer
value pointer to store data in
Returns:
0 on success, otherwise failure

Definition at line 52 of file byte_extract.c.

References BIG, inBounds(), and LITTLE.

Referenced by ByteJump(), and ByteTest().

int string_extract int  bytes_to_grab,
int  base,
u_int8_t ptr,
u_int8_t start,
u_int8_t end,
u_int32_t value
 

Grab a string representation of data from a buffer

Parameters:
base base representation for data: -> man stroul()
bytes_to_grab how many bytes should we grab from the packet
data pointer to where to grab the data from
start pointer to start range of buffer
end pointer to end range of buffer
value pointer to store data in
Returns:
0 on success, otherwise failure

Definition at line 129 of file byte_extract.c.

References inBounds(), strtoul(), and TEXTLEN.

Referenced by ByteJump(), and ByteTest().


Generated on Sun May 14 14:51:22 2006 by  doxygen 1.4.2