mirror of https://github.com/ARMmbed/mbed-os.git
Add LWIP Broadcast option for UDP socket.
parent
b96afd92e2
commit
dcc69d7a80
|
@ -567,6 +567,22 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case NSAPI_BROADCAST:
|
||||||
|
if (NETCONNTYPE_GROUP(s->conn->type) != NETCONN_UDP) {
|
||||||
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optlen != sizeof(int)) {
|
||||||
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(const int *)optval) {
|
||||||
|
ip_set_option(s->conn->pcb.ip, SOF_BROADCAST);
|
||||||
|
} else {
|
||||||
|
ip_reset_option(s->conn->pcb.ip, SOF_BROADCAST);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case NSAPI_ADD_MEMBERSHIP:
|
case NSAPI_ADD_MEMBERSHIP:
|
||||||
case NSAPI_DROP_MEMBERSHIP: {
|
case NSAPI_DROP_MEMBERSHIP: {
|
||||||
if (optlen != sizeof(nsapi_ip_mreq_t)) {
|
if (optlen != sizeof(nsapi_ip_mreq_t)) {
|
||||||
|
|
|
@ -318,6 +318,7 @@ typedef enum nsapi_socket_option {
|
||||||
NSAPI_LATENCY, /*!< Read estimated latency to destination */
|
NSAPI_LATENCY, /*!< Read estimated latency to destination */
|
||||||
NSAPI_STAGGER, /*!< Read estimated stagger value to destination */
|
NSAPI_STAGGER, /*!< Read estimated stagger value to destination */
|
||||||
NSAPI_IPTOS, /*!< Set IP type of service to set specific precedence */
|
NSAPI_IPTOS, /*!< Set IP type of service to set specific precedence */
|
||||||
|
NSAPI_BROADCAST /*!< Set broadcast flag for UDP socket */
|
||||||
} nsapi_socket_option_t;
|
} nsapi_socket_option_t;
|
||||||
|
|
||||||
typedef enum nsapi_tlssocket_level {
|
typedef enum nsapi_tlssocket_level {
|
||||||
|
|
Loading…
Reference in New Issue