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_sebek(u_int32_t magic, u_int16_t version, u_int16_t type, | libnet_build_sebek(uint32_t magic, uint16_t version, uint16_t type, |
u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, | uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid, |
u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, | uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length, |
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; | uint32_t n; |
libnet_pblock_t *p; |
libnet_pblock_t *p; |
struct libnet_sebek_hdr sebek_hdr; |
struct libnet_sebek_hdr sebek_hdr; |
|
|
Line 75 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l
|
Line 75 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l
|
sebek_hdr.pid = htonl(pid); |
sebek_hdr.pid = htonl(pid); |
sebek_hdr.uid = htonl(uid); |
sebek_hdr.uid = htonl(uid); |
sebek_hdr.fd = htonl(fd); |
sebek_hdr.fd = htonl(fd); |
memcpy(sebek_hdr.cmd, cmd, SEBEK_CMD_LENGTH*sizeof(u_int8_t)); | memcpy(sebek_hdr.cmd, cmd, SEBEK_CMD_LENGTH*sizeof(uint8_t)); |
sebek_hdr.length = htonl(length); |
sebek_hdr.length = htonl(length); |
|
|
n = libnet_pblock_append(l, p, (u_int8_t *)&sebek_hdr, LIBNET_SEBEK_H); | n = libnet_pblock_append(l, p, (uint8_t *)&sebek_hdr, LIBNET_SEBEK_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, 0, LIBNET_PBLOCK_SEBEK_H)); |
return (ptag ? ptag : libnet_pblock_update(l, p, 0, LIBNET_PBLOCK_SEBEK_H)); |
bad: |
bad: |