From 462714d9b6e1cf13d994bc4e50b05d71291721e1 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 11 Mar 2010 15:34:49 -0800 Subject: Replace C99/C++ comments with traditional C comments. (alon.barlev@gmail.com) --- libnet/sample/test_ipv4_options.c | 2 +- libnet/sample/test_ipv6_icmpv4.c | 2 +- libnet/src/libnet_build_ip.c | 37 ++++++++++++++++++++----------------- libnet/src/libnet_init.c | 2 +- libnet/src/libnet_link_win32.c | 8 ++++---- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/libnet/sample/test_ipv4_options.c b/libnet/sample/test_ipv4_options.c index c128cb5..71b5335 100644 --- a/libnet/sample/test_ipv4_options.c +++ b/libnet/sample/test_ipv4_options.c @@ -152,7 +152,7 @@ void assert_lengths(libnet_t* l, int ip_len, int ip_ihl, int payload_s) libnet_diag_dump_hex(pkt1, 14, 1, stdout); libnet_diag_dump_hex(pkt1+14, pkt1_sz-14, 1, stdout); - // check ip IHL value, total ip pkt length, and options value + /* check ip IHL value, total ip pkt length, and options value */ h1 = (struct libnet_ipv4_hdr*) (pkt1+14); assert_eq(h1->ip_hl, ip_ihl); assert_eq(ntohs(h1->ip_len), ip_len); diff --git a/libnet/sample/test_ipv6_icmpv4.c b/libnet/sample/test_ipv6_icmpv4.c index 8c1808a..704c5ac 100644 --- a/libnet/sample/test_ipv6_icmpv4.c +++ b/libnet/sample/test_ipv6_icmpv4.c @@ -91,7 +91,7 @@ main(int argc, char *argv[]) ipv6_ptag = libnet_build_ipv6( 0, 0, - LIBNET_ICMPV6_H + sizeof(payload), // ICMPV6_H == ICMPV4_H, luckily + LIBNET_ICMPV6_H + sizeof(payload), /* ICMPV6_H == ICMPV4_H, luckily */ IPPROTO_ICMP6, 255, *(struct libnet_in6_addr*)&src_ip, diff --git a/libnet/src/libnet_build_ip.c b/libnet/src/libnet_build_ip.c index e0cde44..43ba382 100644 --- a/libnet/src/libnet_build_ip.c +++ b/libnet/src/libnet_build_ip.c @@ -83,9 +83,10 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) ip_hdr.ip_hl += p->prev->b_len / 4; } } - // Note that p->h_len is not adjusted. This seems a bug, but it is because - // it is not used! libnet_do_checksum() is passed the h_len (as `len'), - // but for IPPROTO_IP it is ignored in favor of the ip_hl. + /* Note that p->h_len is not adjusted. This seems a bug, but it is because + * it is not used! libnet_do_checksum() is passed the h_len (as `len'), + * but for IPPROTO_IP it is ignored in favor of the ip_hl. + */ ip_hdr.ip_tos = tos; /* IP tos */ ip_hdr.ip_len = htons(ip_len); /* total length */ @@ -147,16 +148,17 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) if (payload_s) { /* update ptag_data with the new payload */ - // on create: - // b_len = payload_s - // l->total_size += b_len - // h_len = 0 - // on update: - // b_len = payload_s - // h_len += - // increments if if b_len goes up, down if it goes down - // in either case: - // copied = 0 + /* on create: + * b_len = payload_s + * l->total_size += b_len + * h_len = 0 + * on update: + * b_len = payload_s + * h_len += + * increments if if b_len goes up, down if it goes down + * in either case: + * copied = 0 + */ p_data = libnet_pblock_probe(l, ptag_data, payload_s, LIBNET_PBLOCK_IPDATA); if (p_data == NULL) @@ -171,7 +173,7 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) if (ptag_data == LIBNET_PTAG_INITIALIZER) { - // IPDATA's h_len gets set to payload_s in both branches + /* IPDATA's h_len gets set to payload_s in both branches */ if (p_data->prev->type == LIBNET_PBLOCK_IPV4_H) { libnet_pblock_update(l, p_data, payload_s, @@ -181,9 +183,10 @@ const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag) } else { - // SR - I'm not sure how to reach this code. Maybe if the first - // time we added an ipv4 block, there was no payload, but when - // we modify the block the next time, we have payload? + /* SR - I'm not sure how to reach this code. Maybe if the first + * time we added an ipv4 block, there was no payload, but when + * we modify the block the next time, we have payload? + */ /* update without setting this as the final pblock */ p_data->type = LIBNET_PBLOCK_IPDATA; diff --git a/libnet/src/libnet_init.c b/libnet/src/libnet_init.c index 1b53dca..b6ff7ec 100644 --- a/libnet/src/libnet_init.c +++ b/libnet/src/libnet_init.c @@ -243,7 +243,7 @@ libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag) uint32_t libnet_getpacket_size(libnet_t *l) { - // Why doesn't this return l->total_size? + /* Why doesn't this return l->total_size? */ libnet_pblock_t *p; uint32_t n; diff --git a/libnet/src/libnet_link_win32.c b/libnet/src/libnet_link_win32.c index a04e447..782e5c6 100644 --- a/libnet/src/libnet_link_win32.c +++ b/libnet/src/libnet_link_win32.c @@ -36,7 +36,7 @@ #include "../include/config.h" #endif #include -#include // From the Microsoft Platform SDK +#include /* From the Microsoft Platform SDK */ #include "../include/win32/libnet.h" #include #include @@ -234,7 +234,7 @@ libnet_get_hwaddr(libnet_t *l) struct hostent *gethostbyname2(const int8_t *name, int af) { - // XXX not implemented + /* XXX not implemented */ return(NULL); } @@ -312,7 +312,7 @@ BYTE * libnet_win32_read_arp_table(DWORD DestIP) if(status == NO_ERROR) { - // set current interface + /* set current interface */ ci = pIpNetTable->table[0].dwIndex; for (i = 0; i < pIpNetTable->dwNumEntries; ++i) @@ -320,7 +320,7 @@ BYTE * libnet_win32_read_arp_table(DWORD DestIP) if (pIpNetTable->table[i].dwIndex != ci) ci = pIpNetTable->table[i].dwIndex; - if(pIpNetTable->table[i].dwAddr == DestIP) // found IP in arp cache + if(pIpNetTable->table[i].dwAddr == DestIP) /* found IP in arp cache */ { memcpy(buffMAC, pIpNetTable->table[i].bPhysAddr, sizeof(buffMAC)); free(pIpNetTable); -- cgit v1.2.1