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

Merge pull request #3885 from authmillenon/socket_base/clean/rm

socket_base: remove deprecated header files
This commit is contained in:
Hauke Petersen 2015-09-24 16:14:06 +02:00
commit 177dd5fd84
4 changed files with 0 additions and 516 deletions

View File

@ -1,51 +0,0 @@
/*
* Copyright (C) 2013 INRIA.
*
* 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 socket_base Transport layer implementation
*
* @ingroup net
* @brief This module implements basic transport layer socket functionality.
* This includes 6LoWPAN UDP header compression and (experimental)
* 6LoWPAN TCP header compression.
*
* It wraps all API types, constants and functions of the transport layer
* implementation.
*
* @see <a href="http://tools.ietf.org/html/rfc6282#section-4.3">
* RFC 6282 - Compression Format for IPv6 Datagrams over
* IEEE 802.15.4-Based Networks - UDP Header Compression
* </a>
* @see <a href="http://tools.ietf.org/html/draft-aayadi-6lowpan-tcphc-01">
* RFC draft-aayadi-6lowpan-tcphc-01 - TCP header compression for
* 6LoWPAN
* </a>
* @{
* @file
* @brief transport_layer functions
* @author Oliver Gesch <oliver.gesch@googlemail.com>
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SOCKET_BASE_H
#define SOCKET_BASE_H
#include "socket_base/in.h"
#include "socket_base/socket.h"
#include "socket_base/types.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* SOCKET_BASE_H */
/** @} */

View File

@ -1,160 +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.
*/
/**
* socket_base/in.h - Constants defined by the internet system, per RFC 790,
* September 1981, and numerous additions, inspired by
* netinet/in.h definitions.
* @{
* @file
* @brief IP next header constants
* @see <a href="http://tools.ietf.org/html/rfc790">
* RFC790 - Assigned Numbers
* </a>
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html">
* IEEE Std 1003.1, 2013 Edition - netinet/in.h
* </a>
* @see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">
* IANA - Protocol Numbers
* </a>
* @author Oliver Gesch <oliver.gesch@googlemail.com>
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SOCKET_BASE_IN_H
#define SOCKET_BASE_IN_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Protocols (RFC 1700) TODO: may be deleted due to some double definition
* in sys/net/sixlowpan/include/sixlowpan/ip.h
*/
#define IPPROTO_IP (0) ///< dummy for IP
#define IPPROTO_HOPOPTS (0) ///< IP6 hop-by-hop options
#define IPPROTO_ICMP (1) ///< control message protocol
#define IPPROTO_IGMP (2) ///< group mgmt protocol
#define IPPROTO_GGP (3) ///< gateway^2 (deprecated)
#define IPPROTO_IPV4 (4) ///< IPv4 encapsulation
#define IPPROTO_IPIP IPPROTO_IPV4 ///< for compatibility
#define IPPROTO_TCP (6) ///< tcp
#define IPPROTO_ST (7) ///< Stream protocol II
#define IPPROTO_EGP (8) ///< exterior gateway protocol
#define IPPROTO_PIGP (9) ///< private interior gateway
#define IPPROTO_RCCMON (10) ///< BBN RCC Monitoring
#define IPPROTO_NVPII (11) ///< network voice protocol
#define IPPROTO_PUP (12) ///< pup
#define IPPROTO_ARGUS (13) ///< Argus
#define IPPROTO_EMCON (14) ///< EMCON
#define IPPROTO_XNET (15) ///< Cross Net Debugger
#define IPPROTO_CHAOS (16) ///< Chaos
#define IPPROTO_UDP (17) ///< user datagram protocol
#define IPPROTO_MUX (18) ///< Multiplexing
#define IPPROTO_MEAS (19) ///< DCN Measurement Subsystems
#define IPPROTO_HMP (20) ///< Host Monitoring
#define IPPROTO_PRM (21) ///< Packet Radio Measurement
#define IPPROTO_IDP (22) ///< xns idp
#define IPPROTO_TRUNK1 (23) ///< Trunk-1
#define IPPROTO_TRUNK2 (24) ///< Trunk-2
#define IPPROTO_LEAF1 (25) ///< Leaf-1
#define IPPROTO_LEAF2 (26) ///< Leaf-2
#define IPPROTO_RDP (27) ///< Reliable Data
#define IPPROTO_IRTP (28) ///< Reliable Transaction
#define IPPROTO_TP (29) ///< tp-4 w/ class negotiation
#define IPPROTO_BLT (30) ///< Bulk Data Transfer
#define IPPROTO_NSP (31) ///< Network Services
#define IPPROTO_INP (32) ///< Merit Internodal
#define IPPROTO_SEP (33) ///< Sequential Exchange
#define IPPROTO_3PC (34) ///< Third Party Connect
#define IPPROTO_IDPR (35) ///< InterDomain Policy Routing
#define IPPROTO_XTP (36) ///< XTP
#define IPPROTO_DDP (37) ///< Datagram Delivery
#define IPPROTO_CMTP (38) ///< Control Message Transport
#define IPPROTO_TPXX (39) ///< TP++ Transport
#define IPPROTO_IL (40) ///< IL transport protocol
#define IPPROTO_IPV6 (41) ///< IP6 header
#define IPPROTO_SDRP (42) ///< Source Demand Routing
#define IPPROTO_ROUTING (43) ///< IP6 routing header
#define IPPROTO_FRAGMENT (44) ///< IP6 fragmentation header
#define IPPROTO_IDRP (45) ///< InterDomain Routing
#define IPPROTO_RSVP (46) ///< resource reservation
#define IPPROTO_GRE (47) ///< General Routing Encap.
#define IPPROTO_MHRP (48) ///< Mobile Host Routing
#define IPPROTO_BHA (49) ///< BHA
#define IPPROTO_ESP (50) ///< IP6 Encap Sec. Payload
#define IPPROTO_AH (51) ///< IP6 Auth Header
#define IPPROTO_INLSP (52) ///< Integ. Net Layer Security
#define IPPROTO_SWIPE (53) ///< IP with encryption
#define IPPROTO_NHRP (54) ///< Next Hop Resolution
///< 55-57: Unassigned
#define IPPROTO_ICMPV6 (58) ///< ICMP6
#define IPPROTO_NONE (59) ///< IP6 no next header
#define IPPROTO_DSTOPTS (60) ///< IP6 destination option
#define IPPROTO_AHIP (61) ///< any host internal protocol
#define IPPROTO_CFTP (62) ///< CFTP
#define IPPROTO_HELLO (63) ///< "hello" routing protocol
#define IPPROTO_SATEXPAK (64) ///< SATNET/Backroom EXPAK
#define IPPROTO_KRYPTOLAN (65) ///< Kryptolan
#define IPPROTO_RVD (66) ///< Remote Virtual Disk
#define IPPROTO_IPPC (67) ///< Pluribus Packet Core
#define IPPROTO_ADFS (68) ///< Any distributed FS
#define IPPROTO_SATMON (69) ///< Satnet Monitoring
#define IPPROTO_VISA (70) ///< VISA Protocol
#define IPPROTO_IPCV (71) ///< Packet Core Utility
#define IPPROTO_CPNX (72) ///< Comp. Prot. Net. Executive
#define IPPROTO_CPHB (73) ///< Comp. Prot. HeartBeat
#define IPPROTO_WSN (74) ///< Wang Span Network
#define IPPROTO_PVP (75) ///< Packet Video Protocol
#define IPPROTO_BRSATMON (76) ///< BackRoom SATNET Monitoring
#define IPPROTO_ND (77) ///< Sun net disk proto (temp.)
#define IPPROTO_WBMON (78) ///< WIDEBAND Monitoring
#define IPPROTO_WBEXPAK (79) ///< WIDEBAND EXPAK
#define IPPROTO_EON (80) ///< ISO cnlp
#define IPPROTO_VMTP (81) ///< VMTP
#define IPPROTO_SVMTP (82) ///< Secure VMTP
#define IPPROTO_VINES (83) ///< Banyon VINES
#define IPPROTO_TTP (84) ///< TTP
#define IPPROTO_IGP (85) ///< NSFNET-IGP
#define IPPROTO_DGP (86) ///< dissimilar gateway prot.
#define IPPROTO_TCF (87) ///< TCF
#define IPPROTO_IGRP (88) ///< Cisco/GXS IGRP
#define IPPROTO_OSPFIGP (89) ///< OSPFIGP
#define IPPROTO_SRPC (90) ///< Strite RPC protocol
#define IPPROTO_LARP (91) ///< Locus Address Resoloution
#define IPPROTO_MTP (92) ///< Multicast Transport
#define IPPROTO_AX25 (93) ///< AX.25 Frames
#define IPPROTO_IPEIP (94) ///< IP encapsulated in IP
#define IPPROTO_MICP (95) ///< Mobile Int.ing control
#define IPPROTO_SCCSP (96) ///< Semaphore Comm. security
#define IPPROTO_ETHERIP (97) ///< Ethernet IP encapsulation
#define IPPROTO_ENCAP (98) ///< encapsulation header
#define IPPROTO_APES (99) ///< any private encr. scheme
#define IPPROTO_GMTP (100) ///< GMTP
#define IPPROTO_IPCOMP (108) ///< payload compression (IPComp)
/**
* 101-254: Partly Unassigned
*/
#define IPPROTO_PIM (103) ///< Protocol Independent Mcast
#define IPPROTO_PGM (113) ///< PGM
/* 255: Reserved */
/* */
#define IPPROTO_DIVERT (254) ///< divert pseudo-protocol (BSD Private, local use, namespace incursion)
#define IPPROTO_RAW (255) ///< raw IP packet
#define IPPROTO_MAX (256)
#define IPPROTO_DONE (257) ///< last return value of *_input(), meaning "all job for this pkt is done".
#define IN_LOOPBACKNET (127) ///< official!
#ifdef __cplusplus
}
#endif
#endif /* SOCKET_BASE_IN_H */

View File

@ -1,221 +0,0 @@
/**
* socket_base/socket.h - Transport Layer socket API
*
* Copyright (C) 2013 INRIA.
*
* 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.
*
* @ingroup socket_base
* @{
* @file
* @brief Header for BSD socket API
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html">
* IEEE Std 1003.1, 2013 Edition - sys/socket.h
* </a>
* @author Oliver Gesch <oliver.gesch@googlemail.com>
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SOCKET_BASE_SOCKET_H
#define SOCKET_BASE_SOCKET_H
#include <stdint.h>
#include "net/af.h"
#include "net/ipv6/addr.h"
#include "socket_base/in.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef uint8_t sa_family_t; ///< POSIX compatible type for address family.
typedef uint32_t socklen_t; ///< POSIX compatible type for address length.
#define SOCK_STREAM 1 ///< POSIX compatible stream socket type.
#define SOCK_DGRAM 2 ///< POSIX compatible datagram socket type.
#define SOCK_RAW 3 ///< POSIX compatible raw-protocol interface type.
#define SOCK_RDM 4 ///< POSIX compatible reliably-delivered message type.
#define SOCK_SEQPACKET 5 ///< POSIX compatible sequenced packet stream type.
#define TRANSPORT_LAYER_SOCKET_STATIC_MSS 48 ///< Static TCP maxmimum segment size.
/**
* Static TCP flow control window for window size 1.
*/
#define TRANSPORT_LAYER_SOCKET_STATIC_WINDOW 1 * TRANSPORT_LAYER_SOCKET_STATIC_MSS
/**
* Maximum size of TCP buffer.
*/
#define TRANSPORT_LAYER_SOCKET_MAX_TCP_BUFFER 1 * TRANSPORT_LAYER_SOCKET_STATIC_WINDOW
/**
* Socket address type for IPv6 communication.
*/
typedef struct __attribute__((packed)) {
uint8_t sin6_family; ///< set to AF_INET6
uint16_t sin6_port; ///< transport layer port number
uint32_t sin6_flowinfo; ///< IPv6 flow information
ipv6_addr_t sin6_addr; ///< IPv6 address
} sockaddr6_t;
/**
* Creates new socket for communication in family *domain*, of type *type*,
* and with protocol *protocol*. Roughly identical to POSIX's
* <a href="http://man.he.net/man2/socket">socket(2)</a>.
*
* @param[in] domain Address family. Only AF_INET6 is supported by now (no
* check on creation).
* @param[in] type Communication type.
* @param[in] protocol Protocol type. May be left 0 if domain and type are
* sufficiant enough (I. e. domain=AF_INET6 and type=SOCK_STREAM
* imply IPPROTO_TCP, etc.)
* @return Socket ID on success, -1 otherwise.
*/
int socket_base_socket(int domain, int type, int protocol);
/**
* Connects socket *socket* with a foreign host with IPv6 address *addr*
* (of length *addrlen*) for connection orientated communication (e. g.
* SOCK_STREAM). Roughly identical to POSIX's
* <a href="http://man.he.net/man2/connect">connect(2)</a>.
*
* @param[in] socket The ID of the socket.
* @param[in] addr The IPv6 address to connect to
* @param[in] addrlen Length of the IPv6 address in byte (always 16)
*
* @return 0 on success, -1 otherwise
*/
int socket_base_connect(int socket, sockaddr6_t *addr,
socklen_t addrlen);
/**
* Receives data through socket *s* and saves it in buffer *buf*. Roughly
* identical to POSIX's <a href="http://man.he.net/man2/recv">recv(2)</a>.
*
* @param[in] s The ID of the socket to receive from.
* @param[in] buf Buffer to store received data in.
* @param[in] len Length of buffer.
* @param[in] flags Flags for possible later implementations (currently
* unused).
*
* @return Number of received bytes, -1 on error.
*/
int32_t socket_base_recv(int s, void *buf, uint32_t len, int flags);
/**
* Receives data through socket *s* and saves it in buffer *buf*. The address
* of the sender is stored in *from*. Roughly identical to POSIX's
* <a href="http://man.he.net/man2/recvfrom">recvfrom(2)</a>.
*
* @param[in] s The ID of the socket to receive from.
* @param[in] buf Buffer to store received data in.
* @param[in] len Length of buffer.
* @param[in] flags Flags for possible later implementations (currently
* unused).
* @param[in] from IPv6 Address of the data's sender.
* @param[in] fromlen Length of address in *from* in byte (always 16).
*
* @return Number of received bytes, -1 on error.
*/
int32_t socket_base_recvfrom(int s, void *buf, uint32_t len, int flags,
sockaddr6_t *from, socklen_t *fromlen);
/**
* Sends data *buf* through socket *s*. Roughly identical to POSIX's
* <a href="http://man.he.net/man2/send">send(2)</a>.
*
* @param[in] s The ID of the socket to send through.
* @param[in] buf Buffer to send the data from.
* @param[in] len Length of buffer.
* @param[in] flags Flags for possible later implementations (currently
* unused).
*
* @return Number of send bytes, -1 on error.
*/
int32_t socket_base_send(int s, const void *buf, uint32_t len, int flags);
/**
* Sends data *buf* through socket *s* to foreign host with IPv6 address *addr*.
* Roughly identical to POSIX's <a href="http://man.he.net/man2/send">send(2)</a>.
*
* @param[in] s The ID of the socket to send through.
* @param[in] buf Buffer to send the data from.
* @param[in] len Length of buffer.
* @param[in] flags Flags for possible later implementations (currently
* unused).
* @param[in] to IPv6 Address to send data to.
* @param[in] tolen Length of address in *to* in byte (always 16).
*
* @return Number of send bytes, -1 on error.
*/
int32_t socket_base_sendto(int s, const void *buf, uint32_t len, int flags,
sockaddr6_t *to, socklen_t tolen);
/**
* Closes the socket *s* and removes it.
*
* @param[in] s The ID of the socket to close.
*
* @return 0 on success, -1 otherwise.
*/
int socket_base_close(int s);
/**
* Assigns an IPv6 address *addr* to the socket *s*. Roughly identical to
* POSIX's <a href="http://man.he.net/man2/bind">bind(2)</a>.
*
* @param[in] s The ID of the socket.
* @param[in] addr The IPv6 address to bind to.
* @param[in] addrlen Length of address in byte (always 16)
*
* @return 0 on success, -1 otherwise.
*/
int socket_base_bind(int s, sockaddr6_t *addr, int addrlen);
/**
* Marks socket *s* as an passive socket, that listens for incoming messages.
* Roughly identical to POSIX's <a href="http://man.he.net/man2/listen">listen(2)</a>.
*
* @param[in] s The ID of the socket.
* @param[in] backlog Not implemented yet, may be 0.
*
* @return 0 on success, -1 otherwise.
*/
int socket_base_listen(int s, int backlog);
/**
* Blocks the current thread and waits for incoming communication on the listening
* socket *s*. Roughly identical to POSIX's
* <a href="http://man.he.net/man2/accept">accept(2)</a>.
*
* @param[in] s The ID of the socket.
* @param[in] addr The IPv6 address of the peer socket, or NULL if not
* needed (not implemented yet).
* @param[in] addrlen The length of *addr*, or NULL if not needed.
*
* @return New socket ID for communication. -1 on error.
*/
int socket_base_accept(int s, sockaddr6_t *addr, socklen_t *addrlen);
/**
* Outputs a list of all open sockets to stdout. Information includes its
* creation parameters, local and foreign address and ports, it's ID and the
* PIDs of the send and receive thread.
*/
void socket_base_print_sockets(void);
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* SOCKET_BASE_SOCKET_H */

View File

@ -1,84 +0,0 @@
/**
* Transport Layer types header
*
* Copyright (C) 2013 INRIA.
*
* 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.
*
* @ingroup transport_layer
* @{
* @file
* @brief Transport Layer types
* @author Oliver Gesch <oliver.gesch@googlemail.com>
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SOCKET_BASE_TYPES_H_
#define SOCKET_BASE_TYPES_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* UDP packet header length
*/
#define UDP_HDR_LEN 8
/**
* TCP packet header length
*/
#define TCP_HDR_LEN 20
/**
* UDP packet header
*
* @see <a href="http://tools.ietf.org/html/rfc768">RFC 768</a>
*/
typedef struct __attribute__((packed)) {
uint16_t src_port; ///< source port
uint16_t dst_port; ///< destination port
uint16_t length; ///< payload length
/**
* internet checksum
*
* @see <a href="http://tools.ietf.org/html/rfc1071">RFC 1071</a>
*/
uint16_t checksum;
} udp_hdr_t;
/**
* TCP packet header
*
* @see <a href="http://tools.ietf.org/html/rfc793">RFC 793</a>
*/
typedef struct __attribute__((packed)) {
uint16_t src_port; ///< source port
uint16_t dst_port; ///< destination port
uint32_t seq_nr; ///< sequence number
uint32_t ack_nr; ///< acknowledgement number
unsigned flag_ns :1; ///< ECN-nonce concealment protection (since RFC 3540).
unsigned reserved :3; ///< for future use - set to zero
unsigned data_offset :4;
uint8_t reserved_flags; ///< TODO: break this down into another bitfield: flag_fin, flag_syn, etc
uint16_t window; ///< receiver window
/**
* internet checksum
*
* @see <a href="http://tools.ietf.org/html/rfc1071">RFC 1071</a>
*/
uint16_t checksum;
uint16_t urg_pointer; ///< urgent pointer
} tcp_hdr_t;
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* SOCKET_BASE_TYPES_H_ */