--- embedaddon/libnet/src/libnet_build_link.c 2012/02/21 22:14:23 1.1.1.1 +++ embedaddon/libnet/src/libnet_build_link.c 2013/07/22 11:54:42 1.1.1.2 @@ -1,5 +1,5 @@ /* - * $Id: libnet_build_link.c,v 1.1.1.1 2012/02/21 22:14:23 misho Exp $ + * $Id: libnet_build_link.c,v 1.1.1.2 2013/07/22 11:54:42 misho Exp $ * * libnet * libnet_build_link.c - link-layer packet assembler @@ -34,6 +34,7 @@ #if (HAVE_CONFIG_H) #include "../include/config.h" #endif + #if (!(_WIN32) || (__CYGWIN__)) #include "../include/libnet.h" #else @@ -41,34 +42,32 @@ #endif libnet_ptag_t -libnet_build_link(u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, -u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag) +libnet_build_link(const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type, +const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) { - u_int8_t org[3] = {0x00, 0x00, 0x00}; + uint8_t org[3] = {0x00, 0x00, 0x00}; switch (l->link_type) { /* add FDDI */ case DLT_EN10MB: - return (libnet_build_ethernet(dst, src, type, payload, payload_s, l, - ptag)); + return libnet_build_ethernet(dst, src, type, payload, payload_s, l, + ptag); case DLT_IEEE802: - return (libnet_build_token_ring(LIBNET_TOKEN_RING_FRAME, + return libnet_build_token_ring(LIBNET_TOKEN_RING_FRAME, LIBNET_TOKEN_RING_LLC_FRAME, dst, src, LIBNET_SAP_SNAP, LIBNET_SAP_SNAP, 0x03, org, type, payload, payload_s, - l, ptag)); - default: - break; + l, ptag); } snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): linktype %d not supported\n", __func__, l->link_type); - return (-1); + return -1; } libnet_ptag_t -libnet_autobuild_link(u_int8_t *dst, u_int8_t *oui, u_int16_t type, libnet_t *l) +libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l) { - u_int8_t org[3] = {0x00, 0x00, 0x00}; + uint8_t org[3] = {0x00, 0x00, 0x00}; switch (l->link_type) { /* add FDDI */ @@ -78,13 +77,9 @@ libnet_autobuild_link(u_int8_t *dst, u_int8_t *oui, u_ return (libnet_autobuild_token_ring(LIBNET_TOKEN_RING_FRAME, LIBNET_TOKEN_RING_LLC_FRAME, dst, LIBNET_SAP_SNAP, LIBNET_SAP_SNAP, 0x03, org, TOKEN_RING_TYPE_IP, l)); - default: - break; } snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): linktype %d not supported\n", __func__, l->link_type); return (-1); } - -/* EOF */