mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-07 18:12:55 +03:00
net.[hc]: allow multiple endpoints in single context
Endpoints will be attached to the context object using a new function coap_attach_endpoint(). The sockfd component has been removed from coap_context_t as it is accessible by the endpoint. coap_endpoint_t has a new field 'context' that refers to the context object the respective endpoint has been associated with, or NULL if it is not attached to any context. An endpoint can be attached to at least one context at a time.
This commit is contained in:
1 parent
cfdfd030f9
commit
3d3eb02ad8
5 files changed
+34
-162
No files matched your search
@@ -37,6 +37,7 @@ struct coap_context_t;
|
||||
* tuple (handle, addr) must uniquely identify this endpoint.
|
||||
*/
|
||||
typedef struct coap_endpoint_t {
|
||||
struct coap_endpoint_t *next;
|
||||
#if defined(WITH_POSIX) || defined(WITH_CONTIKI)
|
||||
union {
|
||||
int fd; /**< on POSIX systems */
|
||||
@@ -46,10 +47,8 @@ typedef struct coap_endpoint_t {
|
||||
|
||||
#ifdef WITH_LWIP
|
||||
struct udp_pcb *pcb;
|
||||
/**< @FIXME --chrysn
|
||||
* this was added in a hurry, not sure it confirms to the overall model */
|
||||
struct coap_context_t *context;
|
||||
#endif /* WITH_LWIP */
|
||||
struct coap_context_t *context;
|
||||
|
||||
coap_address_t addr; /**< local interface address */
|
||||
int ifindex;
|
||||
|
||||
@@ -90,10 +90,6 @@ typedef struct coap_context_t {
|
||||
coap_queue_t *sendqueue;
|
||||
coap_endpoint_t *endpoint; /**< the endpoint used for listening */
|
||||
|
||||
#ifdef WITH_POSIX
|
||||
int sockfd; /**< send/receive socket */
|
||||
#endif /* WITH_POSIX */
|
||||
|
||||
#ifdef WITH_CONTIKI
|
||||
struct uip_udp_conn *conn; /**< uIP connection object */
|
||||
struct etimer retransmit_timer; /**< fires when the next packet must be sent */
|
||||
|
||||
Reference in new issue
Block a user