mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #3878 from authmillenon/net_help/clean/rm
net_help: remove net_help module
This commit is contained in:
commit
fdd255367c
@ -266,10 +266,6 @@ ifneq (,$(filter posix,$(USEMODULE)))
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter cbor,$(USEMODULE)))
|
||||
USEMODULE += net_help
|
||||
endif
|
||||
|
||||
ifneq (,$(filter vtimer,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += timex
|
||||
@ -292,7 +288,6 @@ endif
|
||||
ifneq (,$(filter fib,$(USEMODULE)))
|
||||
USEMODULE += universal_address
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += net_help
|
||||
endif
|
||||
|
||||
ifneq (,$(filter oonf_common,$(USEMODULE)))
|
||||
|
@ -1 +0,0 @@
|
||||
include $(RIOTBASE)/Makefile.base
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Freie Universität Berlin.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @{
|
||||
* @file
|
||||
* @brief Providing implementation for prototypes defined in net_help.h.
|
||||
* @author Oliver Gesch <oliver.gesch@googlemail.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "thread.h"
|
||||
|
||||
#include "net_help.h"
|
||||
|
||||
uint16_t net_help_csum(uint16_t sum, uint8_t *buf, uint16_t len)
|
||||
{
|
||||
int count = len >> 1;
|
||||
|
||||
if (count) {
|
||||
uint16_t carry = 0;
|
||||
|
||||
do {
|
||||
uint16_t t = (*buf << 8) + *(buf + 1);
|
||||
count--;
|
||||
buf += 2;
|
||||
sum += carry;
|
||||
sum += t;
|
||||
carry = (t > sum);
|
||||
} while (count);
|
||||
|
||||
sum += carry;
|
||||
}
|
||||
|
||||
if (len & 1) {
|
||||
uint16_t u = (*buf << 8);
|
||||
sum += (*buf << 8);
|
||||
|
||||
if (sum < u) {
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup net_help Net help
|
||||
* @ingroup net
|
||||
* @brief Helper functions for networking as byte order conversions and checksum calculations
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
*
|
||||
* @author Oliver Gesch <oliver.gesch@googlemail.com>
|
||||
*/
|
||||
|
||||
#ifndef __NET_HELP_H
|
||||
#define __NET_HELP_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "byteorder.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BITSET(var,pos) ((var) & (1<<(pos)))
|
||||
|
||||
/**
|
||||
* @brief Computes the Internet Checksum for *buf* with initial value *init*
|
||||
*
|
||||
* @see <a href="https://tools.ietf.org/html/rfc1071">
|
||||
* RFC 1071
|
||||
* </a>
|
||||
*
|
||||
* @param[in] init Initial value for the checksum (0 in most cases)
|
||||
* @param[in] buf A byte array to calculate the checksum of
|
||||
* @param[in] buf_len Length of *buf*
|
||||
*
|
||||
* @return The Internet Checksum of *buf* with initial value *init*
|
||||
*/
|
||||
uint16_t net_help_csum(uint16_t init, uint8_t *buf, uint16_t buf_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif /* __NET_HELP_H */
|
Loading…
Reference in New Issue
Block a user