From 3e4318fea4addd49d5ee0d1572f3f911728264e7 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 21 Mar 2019 10:30:31 +0100 Subject: [PATCH] [nrf noup]: include: net: Align with bsdlib defines. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding socket family type AF_LOCAL. Adding socket type SOCK_MGMT used in conjuction with with AF_LTE. Adding socket protocol NPROTO_PDN to be used in conjuction with AF_LTE. Adding socket protocol NPROTO_DFU to be used in conjuction with AF_LOCAL. Adding SOL_PDN and SOL_DFU socket option levels, and associated socket option values. Signed-off-by: Glenn Ruben Bakke Signed-off-by: Marti Bolivar (cherry picked from commit 6a62db59a215614f43ed2d8b13b6bef427acc2e2) (cherry picked from commit 6702fed82571fed6f7722a8c3f28a720616121db) Signed-off-by: Martí Bolívar --- include/net/net_ip.h | 15 ++++++++++++--- include/net/socket.h | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/include/net/net_ip.h b/include/net/net_ip.h index b264f21075382f..884be8eeb03029 100644 --- a/include/net/net_ip.h +++ b/include/net/net_ip.h @@ -46,6 +46,7 @@ extern "C" { #define PF_CAN 4 /**< Controller Area Network. */ #define PF_NET_MGMT 5 /**< Network management info. */ #define PF_LTE 102 /**< Specific to LTE. */ +#define PF_LOCAL 103 /**< Local to host. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC /**< Unspecified address family. */ @@ -55,6 +56,7 @@ extern "C" { #define AF_CAN PF_CAN /**< Controller Area Network. */ #define AF_NET_MGMT PF_NET_MGMT /**< Network management info. */ #define AF_LTE PF_LTE /**< Specific to LTE. */ +#define AF_LOCAL PF_LOCAL /**< Local to host. */ /** Protocol numbers from IANA/BSD */ enum net_ip_protocol { @@ -79,13 +81,20 @@ enum net_ip_protocol_secure { /* Protocol numbers for LTE protocols */ enum net_lte_protocol { NPROTO_AT = 513, + NPROTO_PDN = 514 +}; + +/* Protocol numbers for LOCAL protocols */ +enum net_local_protocol { + NPROTO_DFU = 515 }; /** Socket type */ enum net_sock_type { - SOCK_STREAM = 1, /**< Stream socket type */ - SOCK_DGRAM, /**< Datagram socket type */ - SOCK_RAW /**< RAW socket type */ + SOCK_STREAM = 1, /**< Stream socket type */ + SOCK_DGRAM, /**< Datagram socket type */ + SOCK_RAW, /**< RAW socket type */ + SOCK_MGMT /**< Management socket type */ }; /** @brief Convert 16-bit value from network to host byte order. diff --git a/include/net/socket.h b/include/net/socket.h index 873719cee708d6..cfeca070661017 100644 --- a/include/net/socket.h +++ b/include/net/socket.h @@ -789,6 +789,24 @@ struct ifreq { char ifr_name[IFNAMSIZ]; /* Interface name */ }; +/* Protocol level for PDN. */ +#define SOL_PDN 514 + +/* Socket options for SOL_PDN level */ +#define SO_PDN_AF 1 + +/* Protocol level for DFU. */ +#define SOL_DFU 515 + +/* Socket options for SOL_DFU level */ +#define SO_DFU_FW_VERSION 1 +#define SO_DFU_RESOURCE 2 +#define SO_DFU_TIMEO 3 +#define SO_DFU_APPLY 4 +#define SO_DFU_REVERT 5 +#define SO_DFU_BACKUP_DELETE 6 +#define SO_DFU_OFFSET 7 + /** @cond INTERNAL_HIDDEN */ /** * @brief Registration information for a given BSD socket family.