version 1.1.1.1, 2012/02/21 22:14:23
|
version 1.1.1.2, 2013/07/22 11:54:42
|
Line 39
|
Line 39
|
#endif |
#endif |
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_build_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, | libnet_build_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src, |
u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, | uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *org, uint16_t type, |
u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag) | const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) |
{ |
{ |
u_int32_t n, h; | uint32_t n, h; |
libnet_pblock_t *p; |
libnet_pblock_t *p; |
struct libnet_token_ring_hdr token_ring_hdr; |
struct libnet_token_ring_hdr token_ring_hdr; |
|
|
Line 87 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l
|
Line 87 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l
|
memcpy(&token_ring_hdr.token_ring_llc_org_code, org, LIBNET_ORG_CODE_SIZE); |
memcpy(&token_ring_hdr.token_ring_llc_org_code, org, LIBNET_ORG_CODE_SIZE); |
token_ring_hdr.token_ring_type = htons(type); |
token_ring_hdr.token_ring_type = htons(type); |
|
|
n = libnet_pblock_append(l, p, (u_int8_t *)&token_ring_hdr, | n = libnet_pblock_append(l, p, (uint8_t *)&token_ring_hdr, |
LIBNET_TOKEN_RING_H); |
LIBNET_TOKEN_RING_H); |
if (n == -1) |
if (n == -1) |
{ |
{ |
goto bad; |
goto bad; |
} |
} |
|
|
if ((payload && !payload_s) || (!payload && payload_s)) | /* boilerplate payload sanity check / append macro */ |
{ | LIBNET_DO_PAYLOAD(l, p); |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, | |
"%s(): payload inconsistency\n", __func__); | |
goto bad; | |
} | |
| |
if (payload && payload_s) | |
{ | |
n = libnet_pblock_append(l, p, payload, payload_s); | |
if (n == -1) | |
{ | |
goto bad; | |
} | |
} | |
|
|
return (ptag ? ptag : libnet_pblock_update(l, p, h, |
return (ptag ? ptag : libnet_pblock_update(l, p, h, |
LIBNET_PBLOCK_TOKEN_RING_H)); |
LIBNET_PBLOCK_TOKEN_RING_H)); |
Line 119 bad:
|
Line 106 bad:
|
|
|
|
|
libnet_ptag_t |
libnet_ptag_t |
libnet_autobuild_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, | libnet_autobuild_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst, |
u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, | uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *org, uint16_t type, |
libnet_t *l) |
libnet_t *l) |
{ |
{ |
u_int32_t n, h; | uint32_t n, h; |
struct libnet_token_ring_addr *src; |
struct libnet_token_ring_addr *src; |
libnet_pblock_t *p; |
libnet_pblock_t *p; |
libnet_ptag_t ptag; |
libnet_ptag_t ptag; |
Line 178 libnet_t *l)
|
Line 165 libnet_t *l)
|
token_ring_hdr.token_ring_type = htons(type); |
token_ring_hdr.token_ring_type = htons(type); |
|
|
|
|
n = libnet_pblock_append(l, p, (u_int8_t *)&token_ring_hdr, | n = libnet_pblock_append(l, p, (uint8_t *)&token_ring_hdr, |
LIBNET_TOKEN_RING_H); |
LIBNET_TOKEN_RING_H); |
if (n == -1) |
if (n == -1) |
{ |
{ |