Skip to content

Commit 86b1f27

Browse files
author
Arto Kinnunen
authored
Merge pull request ARMmbed#2399 from ARMmbed/IOTTHD-4220
Add EDFE mode to Socket API setsockopt
2 parents 1283077 + fed69e0 commit 86b1f27

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

nanostack/socket_api.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,11 +712,12 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
712712
* | SOCKET_IPV6_MULTICAST_LOOP | bool | Yes | Yes | No |
713713
* | SOCKET_IPV6_JOIN_GROUP | ns_ipv6_mreq_t | Set only | No | No |
714714
* | SOCKET_IPV6_LEAVE_GROUP | ns_ipv6_mreq_t | Set only | No | No |
715+
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
716+
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
717+
* | SOCKET_EDFE_MODE | bool | Set only | No | No |
715718
* | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No |
716719
* | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No |
717720
* | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No |
718-
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
719-
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
720721
*
721722
*/
722723

@@ -755,11 +756,10 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
755756
#define SOCKET_IPV6_JOIN_GROUP 15
756757
/** Leave a multicast group, using ns_ipv6_mreq_t */
757758
#define SOCKET_IPV6_LEAVE_GROUP 16
758-
/** Read estimated latency to reach destination */
759-
#define SOCKET_LATENCY 17
760-
/** Read estimated stagger value that can be used as initial delay after bootstrap or firmware update. */
761-
#define SOCKET_STAGGER 18
762759

760+
#define SOCKET_LATENCY 0xf9 /**< Not standard, read estimated latency to reach destination */
761+
#define SOCKET_STAGGER 0xfa /**< Not standard, read estimated stagger value that can be used as initial delay after bootstrap or firmware update. */
762+
#define SOCKET_EDFE_MODE 0xfb /**< Not standard, Extended Directed Frame Exchange mode enabled/disabled in MAC layer */
763763
#define SOCKET_BROADCAST_PAN 0xfc /**< Internal use - transmit with IEEE 802.15.4 broadcast PAN ID */
764764
#define SOCKET_LINK_LAYER_SECURITY 0xfd /**< Not standard enable or disable socket security at link layer (For 802.15.4). */
765765
#define SOCKET_INTERFACE_SELECT 0xfe /**< Not standard socket interface ID. */

source/6LoWPAN/ws/ws_empty_functions.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@ int ws_test_next_gtk_set(int8_t interface_id, uint8_t *gtk[4])
380380
return -1;
381381
}
382382

383+
int ws_test_6lowpan_fragmentation_mtu_size_set(int8_t interface_id, uint16_t mtu_size)
384+
{
385+
(void) interface_id;
386+
(void) mtu_size;
387+
388+
return -1;
389+
}
390+
383391
int ws_statistics_start(int8_t interface_id, ws_statistics_t *stats_ptr)
384392
{
385393
(void) interface_id;

source/Core/include/ns_buffer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ typedef struct buffer_options {
124124
bool need_predecessor: 1; /*!< Used as an indicator that predecessor address needed */
125125
bool multicast_loop: 1; /*!< We want loopback if we're a group member (TX), or this IS the loopback if RX */
126126
bool mpl_permitted: 1; /*!< MPL will be used if enabled on interface and scope >=3 */
127+
bool edfe_mode: 1; /*!< Use Extended Directed Frame Exchange pattern in MAC layer */
127128
#ifndef NO_IP_FRAGMENT_TX
128129
bool ipv6_dontfrag: 1; /*!< Don't IPv6 fragment (RFC 3542) */
129130
#endif

source/Core/include/ns_socket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ typedef struct inet_pcb_s {
177177
bool recvpktinfo: 1;
178178
bool recvhoplimit: 1;
179179
bool recvtclass: 1;
180+
bool edfe_mode: 1;
180181
int_least24_t flow_label;
181182
NS_LIST_HEAD(inet_group_t, link) mc_groups;
182183
} inet_pcb_t;

source/Core/ns_socket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ inet_pcb_t *socket_inet_pcb_allocate(void)
401401
inet_pcb->recvhoplimit = false;
402402
inet_pcb->recvpktinfo = false;
403403
inet_pcb->recvtclass = false;
404+
inet_pcb->edfe_mode = false;
405+
404406
inet_pcb->link_layer_security = -1;
405407
#ifndef NO_IPV6_PMTUD
406408
inet_pcb->use_min_mtu = -1;
@@ -1134,6 +1136,7 @@ int16_t socket_buffer_sendmsg(int8_t sid, buffer_t *buf, const struct ns_msghdr
11341136
buf->options.ipv6_use_min_mtu = inet_pcb->use_min_mtu;
11351137
buf->options.ipv6_dontfrag = inet_pcb->dontfrag;
11361138
buf->options.multicast_loop = inet_pcb->multicast_loop;
1139+
buf->options.edfe_mode = inet_pcb->edfe_mode;
11371140

11381141
/* Set default remote address from PCB */
11391142
if (inet_pcb->remote_port != 0 && !addr_ipv6_equal(inet_pcb->remote_address, ns_in6addr_any)) {

source/libNET/src/socket_api.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,13 @@ static int8_t ipv6_setsockopt(socket_t *socket_ptr, uint8_t opt_name, const void
960960
inet_pcb->recvtclass = *(const bool *) opt_value;
961961
return 0;
962962
}
963+
case SOCKET_EDFE_MODE: {
964+
if (opt_len != sizeof(bool)) {
965+
return -3;
966+
}
967+
inet_pcb->edfe_mode = *(const bool *) opt_value;
968+
return 0;
969+
}
963970
default:
964971
return -2;
965972
}

0 commit comments

Comments
 (0)