Go to the source code of this file.
Data Structures | |
struct | cpack_state |
Defines | |
#define | cpack_int8(__s, __p) cpack_uint8((__s), (u_int8_t*)(__p)) |
#define | cpack_int16(__s, __p) cpack_uint16((__s), (u_int16_t*)(__p)) |
#define | cpack_int32(__s, __p) cpack_uint32((__s), (u_int32_t*)(__p)) |
#define | cpack_int64(__s, __p) cpack_uint64((__s), (u_int64_t*)(__p)) |
Functions | |
int | cpack_init (struct cpack_state *, u_int8_t *, size_t) |
int | cpack_uint8 (struct cpack_state *, u_int8_t *) |
int | cpack_uint16 (struct cpack_state *, u_int16_t *) |
int | cpack_uint32 (struct cpack_state *, u_int32_t *) |
int | cpack_uint64 (struct cpack_state *, u_int64_t *) |
#define cpack_int8 | ( | __s, | |||
__p | ) | cpack_uint8((__s), (u_int8_t*)(__p)) |
#define cpack_int16 | ( | __s, | |||
__p | ) | cpack_uint16((__s), (u_int16_t*)(__p)) |
#define cpack_int32 | ( | __s, | |||
__p | ) | cpack_uint32((__s), (u_int32_t*)(__p)) |
#define cpack_int64 | ( | __s, | |||
__p | ) | cpack_uint64((__s), (u_int64_t*)(__p)) |
int cpack_init | ( | struct cpack_state * | , | |
u_int8_t * | , | |||
size_t | ||||
) |
Definition at line 71 of file cpack.c.
References cpack_state::c_buf, cpack_state::c_len, and cpack_state::c_next.
Referenced by FillRadioData().
00072 { 00073 memset(cs, 0, sizeof(*cs)); 00074 00075 cs->c_buf = buf; 00076 cs->c_len = buflen; 00077 cs->c_next = cs->c_buf; 00078 00079 return 0; 00080 }
int cpack_uint8 | ( | struct cpack_state * | , | |
u_int8_t * | ||||
) |
Definition at line 132 of file cpack.c.
References cpack_state::c_buf, cpack_state::c_len, and cpack_state::c_next.
Referenced by extract_radiotap_field().
00133 { 00134 /* No space left? */ 00135 if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len) 00136 return -1; 00137 00138 *u = *cs->c_next; 00139 00140 /* Move pointer past the u_int8_t. */ 00141 cs->c_next++; 00142 return 0; 00143 }
int cpack_uint16 | ( | struct cpack_state * | , | |
u_int16_t * | ||||
) |
Definition at line 116 of file cpack.c.
References cpack_state::c_next, cpack_align_and_reserve(), and EXTRACT_LE_16BITS.
Referenced by extract_radiotap_field().
00117 { 00118 u_int8_t *next; 00119 00120 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) 00121 return -1; 00122 00123 *u = EXTRACT_LE_16BITS(next); 00124 00125 /* Move pointer past the u_int16_t. */ 00126 cs->c_next = next + sizeof(*u); 00127 return 0; 00128 }
int cpack_uint32 | ( | struct cpack_state * | , | |
u_int32_t * | ||||
) |
Definition at line 100 of file cpack.c.
References cpack_state::c_next, cpack_align_and_reserve(), and EXTRACT_LE_32BITS.
00101 { 00102 u_int8_t *next; 00103 00104 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) 00105 return -1; 00106 00107 *u = EXTRACT_LE_32BITS(next); 00108 00109 /* Move pointer past the u_int32_t. */ 00110 cs->c_next = next + sizeof(*u); 00111 return 0; 00112 }
int cpack_uint64 | ( | struct cpack_state * | , | |
u_int64_t * | ||||
) |
Definition at line 84 of file cpack.c.
References cpack_state::c_next, cpack_align_and_reserve(), and EXTRACT_LE_64BITS.
Referenced by extract_radiotap_field().
00085 { 00086 u_int8_t *next; 00087 00088 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) 00089 return -1; 00090 00091 *u = EXTRACT_LE_64BITS(next); 00092 00093 /* Move pointer past the u_int64_t. */ 00094 cs->c_next = next + sizeof(*u); 00095 return 0; 00096 }