networking: Move a little more to the inet/ subdirectory.

This commit is contained in:
Gregory Nutt 2017-08-07 13:03:23 -06:00
parent 2ada7d5892
commit 835ae2999d
12 changed files with 57 additions and 46 deletions

View File

@ -1,7 +1,7 @@
############################################################################
# net/devif/Make.defs
# net/inet/Make.defs
#
# Copyright (C) 2007, 2009-2010, 2014-2015 Gregory Nutt. All rights reserved.
# Copyright (C) 2007, 2009-2010, 2014-2015, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -35,8 +35,7 @@
# Network device interface source files
NET_CSRCS += devif_initialize.c net_setipid.c devif_send.c devif_poll.c
NET_CSRCS += devif_callback.c
NET_CSRCS += devif_initialize.c devif_send.c devif_poll.c devif_callback.c
# Device driver IP packet receipt interfaces

View File

@ -274,25 +274,9 @@ struct devif_callback_s
/****************************************************************************
* Public Data
****************************************************************************/
/* Increasing number used for the IP ID field. */
extern uint16_t g_ipid;
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
/* Reassembly timer (units: deci-seconds) */
extern uint8_t g_reassembly_timer;
#endif
/* Time of last poll */
extern systime_t g_polltime;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
@ -300,6 +284,20 @@ extern "C"
#define EXTERN extern
#endif
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_TCP_REASSEMBLY)
/* Reassembly timer (units: deci-seconds) */
EXTERN uint8_t g_reassembly_timer;
#endif
/* Time of last poll */
EXTERN systime_t g_polltime;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: devif_initialize
*

View File

@ -65,9 +65,6 @@
struct net_stats_s g_netstats;
#endif
/* Increasing number used for the IP ID field. */
uint16_t g_ipid;
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_TCP_REASSEMBLY)
/* Reassembly timer (units: deci-seconds) */

View File

@ -93,6 +93,7 @@
#include <nuttx/net/netstats.h>
#include <nuttx/net/ip.h>
#include "inet/inet.h"
#include "tcp/tcp.h"
#include "udp/udp.h"
#include "pkt/pkt.h"

View File

@ -50,6 +50,7 @@
#include <nuttx/net/ip.h>
#include "devif/devif.h"
#include "inet/inet.h"
#include "utils/utils.h"
#include "icmp/icmp.h"

View File

@ -51,6 +51,7 @@
#include <nuttx/net/igmp.h>
#include "devif/devif.h"
#include "inet/inet.h"
#include "igmp/igmp.h"
#ifdef CONFIG_NET_IGMP

View File

@ -37,16 +37,18 @@
ifeq ($(CONFIG_NET_IPv4),y)
SOCK_CSRCS += inet_sockif.c inet_recvfrom.c inet_connect.c inet_close.c
SOCK_CSRCS += inet_globals.c
else ifeq ($(CONFIG_NET_IPv6),y)
SOCK_CSRCS += inet_sockif.c inet_recvfrom.c inet_connect.c inet_close.c
SOCK_CSRCS += inet_globals.c
endif
ifeq ($(CONFIG_NET_IPv4),y)
SOCK_CSRCS += ipv4_getsockname.c
SOCK_CSRCS += ipv4_getsockname.c inet_setipid.c
endif
ifeq ($(CONFIG_NET_IPv6),y)
SOCK_CSRCS += ipv6_getsockname.c inet_globals.c
SOCK_CSRCS += ipv6_getsockname.c
endif
ifeq ($(CONFIG_NET_SENDFILE),y)

View File

@ -82,7 +82,13 @@ extern "C"
#define EXTERN extern
#endif
/* Well-known IP addresses */
#ifdef CONFIG_NET_IPv4
/* Increasing number used for the IP ID field. */
EXTERN uint16_t g_ipid;
#endif /* CONFIG_NET_IPv4 */
/* Well-known IPv6 addresses */
#ifdef CONFIG_NET_IPv6
EXTERN const net_ipv6addr_t g_ipv6_allzeroaddr; /* An address of all zeroes */
@ -93,7 +99,7 @@ EXTERN const net_ipv6addr_t g_ipv6_allrouters; /* All link local routers */
EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link address */
#endif
#endif
#endif
#endif /* CONFIG_NET_IPv6 */
/* PF_INET/PF_INET6 socket address family interface */
@ -110,6 +116,18 @@ struct tcp_conn_s; /* Forward reference */
#endif
struct socket; /* Forward reference */
/****************************************************************************
* Name: inet_setipid
*
* Description:
* This function may be used at boot time to set the initial ip_id.
*
* Assumptions:
*
****************************************************************************/
void inet_setipid(uint16_t id);
/****************************************************************************
* Name: net_startmonitor
*

View File

@ -1,7 +1,7 @@
/****************************************************************************
* net/devif/net_setipid.c
* net/inet/net_setipid.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -43,22 +43,14 @@
#include <stdint.h>
#include <debug.h>
#include "devif/devif.h"
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
#include "inet/inet.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: net_setipid
* Name: inet_setipid
*
* Description:
* This function may be used at boot time to set the initial ip_id.
@ -67,7 +59,7 @@
*
****************************************************************************/
void net_setipid(uint16_t id)
void inet_setipid(uint16_t id)
{
g_ipid = id;
}

View File

@ -55,6 +55,7 @@
#include <nuttx/net/tcp.h>
#include "devif/devif.h"
#include "inet/inet.h"
#include "tcp/tcp.h"
#include "utils/utils.h"

View File

@ -378,11 +378,11 @@ static inline FAR struct udp_conn_s *
* If all of the above are true then the newly received UDP packet
* is destined for this UDP connection.
*
* To send and receive broadcast packets, the application should:
* To send and receive multicast packets, the application should:
*
* - Bind socket to INADDR6_ANY
* - setsockopt to SO_BROADCAST
* - call sendto with sendaddr.sin_addr.s_addr = <broadcast-address>
* - Bind socket to INADDR6_ANY or to a specific <multicast-address>
* - setsockopt to SO_BROADCAST (for all-nodes address)
* - call sendto with sendaddr.sin_addr.s_addr = <multicast-address>
* - call recvfrom.
*
* REVIST: SO_BROADCAST flag is currently ignored.

View File

@ -57,6 +57,7 @@
#include <nuttx/net/udp.h>
#include "devif/devif.h"
#include "inet/inet.h"
#include "utils/utils.h"
#include "udp/udp.h"