1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #3660 from authmillenon/af/api/initial

af: initial import of global AF_ definition header
This commit is contained in:
Martine Lenders 2015-08-25 09:14:44 +02:00
commit 882080460a
10 changed files with 58 additions and 149 deletions

49
sys/include/net/af.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* 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_af UNIX address families
* @ingroup net
* @brief Global UNIX address family definitions
* @{
*
* @file
* @brief Global UNIX address family definitions
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef AF_H_
#define AF_H_
#ifdef __cplusplus
extern "C" {
#endif
enum {
AF_UNSPEC = 0, /**< unspecified address family */
#define AF_UNSPEC AF_UNSPEC /**< unspecified address family (as macro) */
AF_UNIX, /**< local to host (pipes, portals) address family. */
#define AF_UNIX AF_UNIX /**< unspecified address family (as macro) */
AF_INET, /**< internetwork address family: UDP, TCP, etc. */
#define AF_INET AF_INET /**< internetwork address family: UDP, TCP, etc. (as macro) */
AF_INET6, /**< internetwork address family with IPv6: UDP, TCP, etc. */
#define AF_INET6 AF_INET6 /**< internetwork address family with IPv6: UDP, TCP, etc.
* (as macro) */
AF_NUMOF, /**< maximum number of address families on this system */
#define AF_NUMOF AF_NUMOF /**< maximum number of address families on this system (as macro) */
#define AF_MAX AF_NUMOF /**< alias for @ref AF_NUMOF */
};
#ifdef __cplusplus
}
#endif
#endif /* AF_H_ */
/** @} */

View File

@ -15,12 +15,12 @@
* @author Cenk Gündoğan <cnkgndgn@gmail.com>
*/
#include "net/af.h"
#include "net/icmpv6.h"
#include "net/ipv6/hdr.h"
#include "net/gnrc/icmpv6.h"
#include "net/gnrc/ipv6.h"
#include "net/gnrc.h"
#include "inet_ntop.h"
#include "net/eui64.h"
#include "net/gnrc/rpl.h"

View File

@ -16,7 +16,7 @@
*/
#include <stdbool.h>
#include "inet_pton.h"
#include "net/af.h"
#include "net/gnrc/ipv6.h"
#include "net/gnrc/ipv6/netif.h"
#include "net/gnrc/rpl/dodag.h"

View File

@ -18,23 +18,12 @@
#ifndef INET_NTOP_H_
#define INET_NTOP_H_
#include <stdlib.h>
#include "net/af.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef AF_INET
#define AF_INET 2 ///< internetwork address family: UDP, TCP, etc.
#endif
#ifndef AF_INET6
/**
* IPv6 address family.
*
* @see AF_INET
*/
#define AF_INET6 28
#endif
#ifndef IN6ADDRSZ
#define IN6ADDRSZ 16
#endif

View File

@ -18,23 +18,12 @@
#ifndef INET_PTON_H_
#define INET_PTON_H_
#include <stdlib.h>
#include "net/af.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef AF_INET
#define AF_INET 2 ///< internetwork address family: UDP, TCP, etc.
#endif
#ifndef AF_INET6
/**
* IPv6 address family.
*
* @see AF_INET
*/
#define AF_INET6 28
#endif
#ifndef IN6ADDRSZ
#define IN6ADDRSZ 16
#endif

View File

@ -24,7 +24,8 @@
#include <stdint.h>
#include "net/gnrc/ipv6.h"
#include "net/af.h"
#include "net/ipv6/addr.h"
#include "socket_base/in.h"
@ -42,127 +43,6 @@ typedef uint32_t socklen_t; ///< POSIX compatible type for address length.
#define SOCK_RDM 4 ///< POSIX compatible reliably-delivered message type.
#define SOCK_SEQPACKET 5 ///< POSIX compatible sequenced packet stream type.
#define AF_UNSPEC 0 ///< unspecified address family.
#define AF_LOCAL 1 ///< local to host (pipes, portals) address family.
#define AF_UNIX AF_LOCAL ///< alias for AF_LOCAL for backward compatibility.
#ifndef AF_INET
#define AF_INET 2 ///< internetwork address family: UDP, TCP, etc.
#endif
#define AF_IMPLINK 3 ///< ARPAnet IMP address family.
#define AF_PUP 4 ///< PUP protocols address family: e.g. BSP
#define AF_CHAOS 5 ///< MIT CHAOS protocols address family
#define AF_NS 6 ///< XEROX NS protocols address family
#define AF_ISO 7 ///< ISO protocols address family
#define AF_OSI AF_ISO ///< alias for AF_ISO
#define AF_ECMA 8 ///< European computer manufacturers address family
#define AF_DATAKIT 9 ///< datakit protocols address family
#define AF_CCITT 10 ///< CCITT protocols address family, X.25 etc
#define AF_SNA 11 ///< IBM SNA address family
#define AF_DECnet 12 ///< DECnet address family
#define AF_DLI 13 ///< DEC Direct data link interface address family
#define AF_LAT 14 ///< LAT address family
#define AF_HYLINK 15 ///< NSC Hyperchannel address family
#define AF_APPLETALK 16 ///< Apple Talk address family
#define AF_ROUTE 17 ///< Internal Routing Protocol address family
#define AF_LINK 18 ///< Link layer interface address family
#define pseudo_AF_XTP 19 ///< eXpress Transfer Protocol (no AF)
#define AF_COIP 20 ///< connection-oriented IP, aka ST II address family.
#define AF_CNT 21 ///< Computer Network Technology address family
#define pseudo_AF_RTIP 22 ///< Help Identify RTIP packets address family
#define AF_IPX 23 ///< Novell Internet Protocol (no AF)
#define AF_SIP 24 ///< Simple Internet Protocol address family
#define pseudo_AF_PIP 25 ///< Help Identify PIP packets (no AF)
#define AF_ISDN 26 ///< Integrated Services Digital Network address family
#define AF_E164 AF_ISDN ///< CCITT E.164 recommendation
#define pseudo_AF_KEY 27 ///< Internal key-management function (no AF)
#ifndef AF_INET6
/**
* IPv6 address family.
*
* @see AF_INET
*/
#define AF_INET6 28
#endif
#define AF_NATM 29 ///< native ATM access address family
#define AF_ATM 30 ///< ATM address family
#define pseudo_AF_HDRCMPLT 31 ///< Used by BPF to not rewrite headers in interface output routine
#define AF_NETGRAPH 32 ///< Netgraph sockets address family
#define AF_MAX 33 ///< Maximum for address families
/*
* Protocol families, same as address families for now.
*/
#define PF_UNSPEC AF_UNSPEC ///< protocol family
///< @see AF_UNSPEC
#define PF_LOCAL AF_LOCAL ///< protocol family
///< @see AF_LOCAL
#define PF_UNIX PF_LOCAL ///< alias for PF_LOCAL for backward compatibility
#define PF_INET AF_INET ///< protocol family
///< @see AF_INET
#define PF_IMPLINK AF_IMPLINK ///< protocol family
///< @see AF_IMPLINK
#define PF_PUP AF_PUP ///< protocol family
///< @see AF_PUP
#define PF_CHAOS AF_CHAOS ///< protocol family
///< @see AF_CHAOS
#define PF_NS AF_NS ///< protocol family
///< @see AF_NS
#define PF_ISO AF_ISO ///< protocol family
///< @see AF_ISO
#define PF_OSI AF_OSI ///< protocol family
///< @see AF_OSI
#define PF_ECMA AF_ECMA ///< protocol family
///< @see AF_ECMA
#define PF_DATAKIT AF_DATAKIT ///< protocol family
///< @see AF_DATAKIT
#define PF_CCITT AF_CCITT ///< protocol family
///< @see AF_CCITT
#define PF_SNA AF_SNA ///< protocol family
///< @see AF_SNA
#define PF_DECnet AF_DECnet ///< protocol family
///< @see AF_DECnet
#define PF_DLI AF_DLI ///< protocol family
///< @see AF_DLI
#define PF_LAT AF_LAT ///< protocol family
///< @see AF_LAT
#define PF_HYLINK AF_HYLINK ///< protocol family
///< @see AF_HYLINK
#define PF_APPLETALK AF_APPLETALK ///< protocol family
///< @see AF_APPLETALK
#define PF_ROUTE AF_ROUTE ///< protocol family
///< @see AF_ROUTE
#define PF_LINK AF_LINK ///< protocol family
///< @see AF_LINK
#define PF_XTP pseudo_AF_XTP ///< protocol family (no address family defined, only PF)
///< @see pseudo_AF_XTP
#define PF_COIP AF_COIP ///< protocol family
///< @see AF_COIP
#define PF_CNT AF_CNT ///< protocol family
///< @see AF_CNT
#define PF_SIP AF_SIP ///< protocol family
///< @see AF_SIP
#define PF_IPX AF_IPX ///< protocol family (same format as AF_NS)
///< @see AF_IPX
///< @see AF_NS
#define PF_RTIP pseudo_AF_RTIP ///< protocol family (same format as AF_INET)
///< @see pseudo_AF_RTIP
#define PF_PIP pseudo_AF_PIP ///< protocol family
///< @see pseudo_AF_PIP
#define PF_ISDN AF_ISDN ///< protocol family
///< @see AF_ISDN
#define PF_KEY pseudo_AF_KEY ///< protocol family
///< @see pseudo_AF_KEY
#define PF_INET6 AF_INET6 ///< protocol family
///< @see AF_INET6
#define PF_NATM AF_NATM ///< protocol family
///< @see AF_NATM
#define PF_ATM AF_ATM ///< protocol family
///< @see AF_ATM
#define PF_NETGRAPH AF_NETGRAPH ///< protocol family
///< @see AF_NETGRAPH
#define PF_MAX AF_MAX ///< maximum of protocol families
///< @see AF_MAX
#define TRANSPORT_LAYER_SOCKET_STATIC_MSS 48 ///< Static TCP maxmimum segment size.
/**

View File

@ -90,7 +90,7 @@ kernel_pid_t nhdp_start(void)
ipv6_addr_set_all_nodes_addr(&sa_bcast.sin6_addr);
/* Configure sending/receiving UDP socket */
sock_rcv = socket_base_socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
sock_rcv = socket_base_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
/* Start the NHDP thread */
nhdp_pid = thread_create(nhdp_stack, sizeof(nhdp_stack), THREAD_PRIORITY_MAIN - 1,

View File

@ -35,6 +35,7 @@
#include <sys/types.h>
#include "cpu.h"
#include "net/af.h"
#include "socket_base/socket.h"

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include "thread.h"
#include "inet_pton.h"
#include "net/af.h"
#ifdef MODULE_GNRC_NETIF
#include "net/gnrc/netif.h"
#endif