1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

inet_csum: remove ng_ prefix

This commit is contained in:
Martine Lenders 2015-08-07 14:56:36 +02:00
parent 16dcac24d0
commit 5c03268516
11 changed files with 31 additions and 31 deletions

View File

@ -99,12 +99,12 @@ ifneq (,$(filter ng_icmpv6_echo,$(USEMODULE)))
endif
ifneq (,$(filter ng_icmpv6,$(USEMODULE)))
USEMODULE += ng_inet_csum
USEMODULE += inet_csum
USEMODULE += ng_ipv6
endif
ifneq (,$(filter ng_ipv6_hdr,$(USEMODULE)))
USEMODULE += ng_inet_csum
USEMODULE += inet_csum
USEMODULE += ng_pktbuf
endif
@ -125,7 +125,7 @@ ifneq (,$(filter ng_ipv6_router,$(USEMODULE)))
endif
ifneq (,$(filter ng_ipv6,$(USEMODULE)))
USEMODULE += ng_inet_csum
USEMODULE += inet_csum
USEMODULE += ng_ipv6_addr
USEMODULE += ng_ipv6_hdr
USEMODULE += ng_ipv6_nc
@ -144,7 +144,7 @@ endif
ifneq (,$(filter ng_udp,$(USEMODULE)))
USEMODULE += ng_netbase
USEMODULE += ng_inet_csum
USEMODULE += inet_csum
endif
ifneq (,$(filter ng_nettest,$(USEMODULE)))

View File

@ -43,8 +43,8 @@ endif
ifneq (,$(filter ng_ipv6_netif,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6/netif
endif
ifneq (,$(filter ng_inet_csum,$(USEMODULE)))
DIRS += net/crosslayer/ng_inet_csum
ifneq (,$(filter inet_csum,$(USEMODULE)))
DIRS += net/crosslayer/inet_csum
endif
ifneq (,$(filter ng_ndp,$(USEMODULE)))
DIRS += net/network_layer/ng_ndp

View File

@ -7,7 +7,7 @@
*/
/**
* @defgroup net_ng_inet_csum Internet Checksum
* @defgroup net_inet_csum Internet Checksum
* @ingroup net
* @brief Provides a function to calculate the Internet Checksum
* @{
@ -17,8 +17,8 @@
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef NG_INET_CSUM_H_
#define NG_INET_CSUM_H_
#ifndef INET_CSUM_H_
#define INET_CSUM_H_
#include <inttypes.h>
@ -42,11 +42,11 @@ extern "C" {
*
* @return The unnormalized Internet Checksum of @p buf.
*/
uint16_t ng_inet_csum(uint16_t sum, const uint8_t *buf, uint16_t len);
uint16_t inet_csum(uint16_t sum, const uint8_t *buf, uint16_t len);
#ifdef __cplusplus
}
#endif
#endif /* NG_INET_CSUM_H_ */
#endif /* INET_CSUM_H_ */
/** @} */

View File

@ -24,7 +24,7 @@
#include "byteorder.h"
#include "net/ng_ipv6/addr.h"
#include "net/ng_inet_csum.h"
#include "net/inet_csum.h"
#include "net/ng_pkt.h"
#ifdef __cplusplus
@ -294,8 +294,8 @@ static inline uint16_t ng_ipv6_hdr_inet_csum(uint16_t sum, ng_ipv6_hdr_t *hdr,
sum++;
}
return ng_inet_csum(sum + len + prot_num, hdr->src.u8,
(2 * sizeof(ng_ipv6_addr_t)));
return inet_csum(sum + len + prot_num, hdr->src.u8,
(2 * sizeof(ng_ipv6_addr_t)));
}
/**

View File

@ -15,12 +15,12 @@
#include <inttypes.h>
#include <stdio.h>
#include "od.h"
#include "net/ng_inet_csum.h"
#include "net/inet_csum.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
uint16_t ng_inet_csum(uint16_t sum, const uint8_t *buf, uint16_t len)
uint16_t inet_csum(uint16_t sum, const uint8_t *buf, uint16_t len)
{
uint32_t csum = sum;

View File

@ -42,12 +42,12 @@ static inline uint16_t _calc_csum(ng_pktsnip_t *hdr,
uint16_t len = (uint16_t)hdr->size;
while (payload && (payload != hdr)) {
csum = ng_inet_csum(csum, payload->data, payload->size);
csum = inet_csum(csum, payload->data, payload->size);
len += (uint16_t)payload->size;
payload = payload->next;
}
csum = ng_inet_csum(csum, hdr->data, hdr->size);
csum = inet_csum(csum, hdr->data, hdr->size);
csum = ng_ipv6_hdr_inet_csum(csum, pseudo_hdr->data, PROTNUM_ICMPV6,
len);

View File

@ -27,7 +27,7 @@
#include "utlist.h"
#include "net/ng_udp.h"
#include "net/ng_netbase.h"
#include "net/ng_inet_csum.h"
#include "net/inet_csum.h"
#ifdef MODULE_NG_IPV6
#include "net/ng_ipv6/hdr.h"
@ -71,12 +71,12 @@ static uint16_t _calc_csum(ng_pktsnip_t *hdr, ng_pktsnip_t *pseudo_hdr,
/* process the payload */
while (payload && payload != hdr) {
csum = ng_inet_csum(csum, (uint8_t *)(payload->data), payload->size);
csum = inet_csum(csum, (uint8_t *)(payload->data), payload->size);
len += (uint16_t)payload->size;
payload = payload->next;
}
/* process applicable UDP header bytes */
csum = ng_inet_csum(csum, (uint8_t *)hdr->data, sizeof(ng_udp_hdr_t));
csum = inet_csum(csum, (uint8_t *)hdr->data, sizeof(ng_udp_hdr_t));
switch (pseudo_hdr->type) {
#ifdef MODULE_NG_IPV6

View File

@ -1 +1 @@
USEMODULE += ng_inet_csum
USEMODULE += inet_csum

View File

@ -16,7 +16,7 @@
#include "embUnit.h"
#include "net/ng_inet_csum.h"
#include "net/inet_csum.h"
#include "unittests-constants.h"
#include "tests-inet_csum.h"
@ -28,7 +28,7 @@ static void test_inet_csum__rfc_example(void)
0x00, 0x01, 0xf2, 0x03, 0xf4, 0xf5, 0xf6, 0xf7
};
TEST_ASSERT_EQUAL_INT(0xddf2, ng_inet_csum(0, data, sizeof(data)));
TEST_ASSERT_EQUAL_INT(0xddf2, inet_csum(0, data, sizeof(data)));
}
static void test_inet_csum__ipv6_pseudo_hdr(void)
@ -50,7 +50,7 @@ static void test_inet_csum__ipv6_pseudo_hdr(void)
};
/* result unnormalized: take 1's-complement of 0 */
TEST_ASSERT_EQUAL_INT(0xffff, ng_inet_csum(0x0, data, sizeof(data)));
TEST_ASSERT_EQUAL_INT(0xffff, inet_csum(0x0, data, sizeof(data)));
}
static void test_inet_csum__set_initial_sum(void)
@ -72,7 +72,7 @@ static void test_inet_csum__set_initial_sum(void)
/* result unnormalized: take 1's-complement of 0
* set next header and payload length as initial value */
TEST_ASSERT_EQUAL_INT(0xffff, ng_inet_csum(0x38 + 0x3a, data, sizeof(data)));
TEST_ASSERT_EQUAL_INT(0xffff, inet_csum(0x38 + 0x3a, data, sizeof(data)));
}
static void test_inet_csum__wraps_more_than_once(void)
@ -87,7 +87,7 @@ static void test_inet_csum__wraps_more_than_once(void)
};
/* values were taken from a case I encountered in the wild */
TEST_ASSERT_EQUAL_INT(0x0002, ng_inet_csum(0x1785, data, sizeof(data)));
TEST_ASSERT_EQUAL_INT(0x0002, inet_csum(0x1785, data, sizeof(data)));
}
static void test_inet_csum__calculate_csum(void)
@ -101,7 +101,7 @@ static void test_inet_csum__calculate_csum(void)
};
/* result unnormalized: take 1's-complement of 0xb861 */
TEST_ASSERT_EQUAL_INT(0x479e, ng_inet_csum(0, data, sizeof(data)));
TEST_ASSERT_EQUAL_INT(0x479e, inet_csum(0, data, sizeof(data)));
}
static void test_inet_csum__odd_len(void)
@ -118,7 +118,7 @@ static void test_inet_csum__odd_len(void)
/* result unnormalized: take 1's-complement of 0
* set next header and payload length as initial value */
TEST_ASSERT_EQUAL_INT(0xffff, ng_inet_csum(17 + 39, data, sizeof(data)));
TEST_ASSERT_EQUAL_INT(0xffff, inet_csum(17 + 39, data, sizeof(data)));
}
Test *tests_inet_csum_tests(void)

View File

@ -20,7 +20,7 @@
#include "net/ng_ipv6/hdr.h"
#include "net/ng_pktbuf.h"
#include "net/protnum.h"
#include "net/ng_inet_csum.h"
#include "net/inet_csum.h"
#include "unittests-constants.h"
#include "tests-ipv6_hdr.h"
@ -293,7 +293,7 @@ static void test_ipv6_hdr_inet_csum__initial_sum_0(void)
res = ng_ipv6_hdr_inet_csum(0, (ng_ipv6_hdr_t *)&val, PROTNUM_ICMPV6,
payload_len);
/* calculate checksum of payload */
res = ng_inet_csum(res, val + sizeof(ng_ipv6_hdr_t), payload_len);
res = inet_csum(res, val + sizeof(ng_ipv6_hdr_t), payload_len);
res = ~res; /* take 1's-complement for correct checksum */
TEST_ASSERT_EQUAL_INT(0xab32, res);