Skip to content

Commit b697fd1

Browse files
Rallarembolivar-nordic
authored andcommitted
[nrf noup] include: net: add nRF91 extensions
Add some socket options and address family extensions to Zephyr headers, which will be useful for nRF91. - AF_LTE family - AF_LOCAL family - NPROTO_AT protocol - NPROTO_PDN protocol, to be used in conjuction with AF_LTE - NPROTO_DFU protocol to be used in conjuction with AF_LOCAL - SOCK_MGMT socket type, used in conjunction with AF_LTE - SO_RCVTIMEO socket option - SO_BINDTODEVICE socket option - SOL_PDN and SOL_DFU socket option levels, and associated socket option values: SO_PDN_CONTEXT_ID option for PDN sockets, SO_PDN_STATE option for PDN sockets to retrieve the state of the PDN connection - SOL_DFU protocol level and socket options. This includes a SO_DFU_ERROR socket option for DFU socket can be used when a operation on a DFU socket returns -ENOEXEC, indicating that the modem has rejected the operation, to retrieve the reason for the error. Signed-off-by: Håkon Alseth <[email protected]> Signed-off-by: Robert Lubos <[email protected]> Signed-off-by: Martí Bolívar <[email protected]> Signed-off-by: Glenn Ruben Bakke <[email protected]> Signed-off-by: Christopher Métrailler <[email protected]> Signed-off-by: Emanuele Di Santo <[email protected]> (cherry picked from commit 4c24a64)
1 parent 2e0abca commit b697fd1

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

include/net/net_ip.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ extern "C" {
4545
#define PF_PACKET 3 /**< Packet family. */
4646
#define PF_CAN 4 /**< Controller Area Network. */
4747
#define PF_NET_MGMT 5 /**< Network management info. */
48+
#define PF_LTE 102 /**< Specific to LTE. */
49+
#define PF_LOCAL 103 /**< Local to host. */
4850

4951
/* Address families. */
5052
#define AF_UNSPEC PF_UNSPEC /**< Unspecified address family. */
@@ -53,6 +55,8 @@ extern "C" {
5355
#define AF_PACKET PF_PACKET /**< Packet family. */
5456
#define AF_CAN PF_CAN /**< Controller Area Network. */
5557
#define AF_NET_MGMT PF_NET_MGMT /**< Network management info. */
58+
#define AF_LTE PF_LTE /**< Specific to LTE. */
59+
#define AF_LOCAL PF_LOCAL /**< Local to host. */
5660

5761
/** Protocol numbers from IANA/BSD */
5862
enum net_ip_protocol {
@@ -74,11 +78,23 @@ enum net_ip_protocol_secure {
7478
IPPROTO_DTLS_1_2 = 273, /**< DTLS 1.2 protocol */
7579
};
7680

81+
/* Protocol numbers for LTE protocols */
82+
enum net_lte_protocol {
83+
NPROTO_AT = 513,
84+
NPROTO_PDN = 514
85+
};
86+
87+
/* Protocol numbers for LOCAL protocols */
88+
enum net_local_protocol {
89+
NPROTO_DFU = 515
90+
};
91+
7792
/** Socket type */
7893
enum net_sock_type {
79-
SOCK_STREAM = 1, /**< Stream socket type */
80-
SOCK_DGRAM, /**< Datagram socket type */
81-
SOCK_RAW /**< RAW socket type */
94+
SOCK_STREAM = 1, /**< Stream socket type */
95+
SOCK_DGRAM, /**< Datagram socket type */
96+
SOCK_RAW, /**< RAW socket type */
97+
SOCK_MGMT /**< Management socket type */
8298
};
8399

84100
/** @brief Convert 16-bit value from network to host byte order.

include/net/socket.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ static inline char *inet_ntop(sa_family_t family, const void *src, char *dst,
766766
#define SO_REUSEADDR 2
767767
/** sockopt: Async error (ignored, for compatibility) */
768768
#define SO_ERROR 4
769+
#define SO_RCVTIMEO 20
770+
#define SO_BINDTODEVICE 25
769771

770772
/** sockopt: Timestamp TX packets */
771773
#define SO_TIMESTAMPING 37
@@ -789,6 +791,34 @@ static inline char *inet_ntop(sa_family_t family, const void *src, char *dst,
789791
/** sockopt: Enable SOCKS5 for Socket */
790792
#define SO_SOCKS5 60
791793

794+
/* Interface description structure */
795+
#define IFNAMSIZ 64
796+
797+
struct ifreq {
798+
char ifr_name[IFNAMSIZ]; /* Interface name */
799+
};
800+
801+
/* Protocol level for PDN. */
802+
#define SOL_PDN 514
803+
804+
/* Socket options for SOL_PDN level */
805+
#define SO_PDN_AF 1
806+
#define SO_PDN_CONTEXT_ID 2
807+
#define SO_PDN_STATE 3
808+
809+
/* Protocol level for DFU. */
810+
#define SOL_DFU 515
811+
812+
/* Socket options for SOL_DFU level */
813+
#define SO_DFU_FW_VERSION 1
814+
#define SO_DFU_RESOURCES 2
815+
#define SO_DFU_TIMEO 3
816+
#define SO_DFU_APPLY 4
817+
#define SO_DFU_REVERT 5
818+
#define SO_DFU_BACKUP_DELETE 6
819+
#define SO_DFU_OFFSET 7
820+
#define SO_DFU_ERROR 20
821+
792822
/** @cond INTERNAL_HIDDEN */
793823
/**
794824
* @brief Registration information for a given BSD socket family.

0 commit comments

Comments
 (0)