|
libcoap
4.2.1
|
Include dependency graph for coap_session.c:Go to the source code of this file.
Macros | |
| #define | COAP_SESSION_C_ |
| #define | OFF_CONTENT_TYPE 0 /* offset of content_type in dtls_record_handshake_t */ |
| #define | DTLS_CT_ALERT 21 /* Content Type Alert */ |
| #define | DTLS_CT_HANDSHAKE 22 /* Content Type Handshake */ |
| #define | OFF_HANDSHAKE_TYPE 13 /* offset of handshake in dtls_record_handshake_t */ |
| #define | DTLS_HT_CLIENT_HELLO 1 /* Client Hello handshake type */ |
| #define | INET6_ADDRSTRLEN 40 |
Functions | |
| void | coap_session_set_max_retransmit (coap_session_t *session, unsigned int value) |
| Set the CoAP maximum retransmit count before failure. More... | |
| void | coap_session_set_ack_timeout (coap_session_t *session, coap_fixed_point_t value) |
| Set the CoAP initial ack response timeout before the next re-transmit. More... | |
| void | coap_session_set_ack_random_factor (coap_session_t *session, coap_fixed_point_t value) |
| Set the CoAP ack randomize factor. More... | |
| unsigned int | coap_session_get_max_transmit (coap_session_t *session) |
| Get the CoAP maximum retransmit before failure. More... | |
| coap_fixed_point_t | coap_session_get_ack_timeout (coap_session_t *session) |
| Get the CoAP initial ack response timeout before the next re-transmit. More... | |
| coap_fixed_point_t | coap_session_get_ack_random_factor (coap_session_t *session) |
| Get the CoAP ack randomize factor. More... | |
| coap_session_t * | coap_session_reference (coap_session_t *session) |
| Increment reference counter on a session. More... | |
| void | coap_session_release (coap_session_t *session) |
| Decrement reference counter on a session. More... | |
| void | coap_session_set_app_data (coap_session_t *session, void *app_data) |
Stores data with the given session. More... | |
| void * | coap_session_get_app_data (const coap_session_t *session) |
Returns any application-specific data that has been stored with session using the function coap_session_set_app_data(). More... | |
| static coap_session_t * | coap_make_session (coap_proto_t proto, coap_session_type_t type, const coap_address_t *local_if, const coap_address_t *local_addr, const coap_address_t *remote_addr, int ifindex, coap_context_t *context, coap_endpoint_t *endpoint) |
| void | coap_session_mfree (coap_session_t *session) |
| void | coap_session_free (coap_session_t *session) |
| size_t | coap_session_max_pdu_size (const coap_session_t *session) |
| Get maximum acceptable PDU size. More... | |
| void | coap_session_set_mtu (coap_session_t *session, unsigned mtu) |
| Set the session MTU. More... | |
| ssize_t | coap_session_send (coap_session_t *session, const uint8_t *data, size_t datalen) |
| Function interface for datagram data transmission. More... | |
| ssize_t | coap_session_write (coap_session_t *session, const uint8_t *data, size_t datalen) |
| Function interface for stream data transmission. More... | |
| ssize_t | coap_session_delay_pdu (coap_session_t *session, coap_pdu_t *pdu, coap_queue_t *node) |
| void | coap_session_send_csm (coap_session_t *session) |
| Notify session transport has just connected and CSM exchange can now start. More... | |
| coap_tid_t | coap_session_send_ping (coap_session_t *session) |
| Send a ping message for the session. More... | |
| void | coap_session_connected (coap_session_t *session) |
| Notify session that it has just connected or reconnected. More... | |
| void | coap_session_disconnected (coap_session_t *session, coap_nack_reason_t reason) |
| Notify session that it has failed. More... | |
| coap_session_t * | coap_endpoint_get_session (coap_endpoint_t *endpoint, const coap_packet_t *packet, coap_tick_t now) |
| coap_session_t * | coap_session_new_dtls_session (coap_session_t *session, coap_tick_t now) |
Create a new DTLS session for the session. More... | |
| static coap_session_t * | coap_session_create_client (coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto) |
| static coap_session_t * | coap_session_connect (coap_session_t *session) |
| static coap_session_t * | coap_session_accept (coap_session_t *session) |
| coap_session_t * | coap_new_client_session (struct coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto) |
| Creates a new client session to the designated server. More... | |
| coap_session_t * | coap_new_client_session_psk (struct coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, const char *identity, const uint8_t *key, unsigned key_len) |
| Creates a new client session to the designated server with PSK credentials. More... | |
| coap_session_t * | coap_new_client_session_pki (struct coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_pki_t *setup_data) |
| Creates a new client session to the designated server with PKI credentials. More... | |
| coap_session_t * | coap_new_server_session (struct coap_context_t *ctx, coap_endpoint_t *ep) |
| Creates a new server session for the specified endpoint. More... | |
| coap_endpoint_t * | coap_new_endpoint (coap_context_t *context, const coap_address_t *listen_addr, coap_proto_t proto) |
| Create a new endpoint for communicating with peers. More... | |
| void | coap_endpoint_set_default_mtu (coap_endpoint_t *ep, unsigned mtu) |
| Set the endpoint's default MTU. More... | |
| void | coap_free_endpoint (coap_endpoint_t *ep) |
| coap_session_t * | coap_session_get_by_peer (coap_context_t *ctx, const coap_address_t *remote_addr, int ifindex) |
| const char * | coap_session_str (const coap_session_t *session) |
| Get session description. More... | |
| const char * | coap_endpoint_str (const coap_endpoint_t *endpoint) |
| Get endpoint description. More... | |
| #define COAP_SESSION_C_ |
Definition at line 12 of file coap_session.c.
| #define DTLS_CT_ALERT 21 /* Content Type Alert */ |
| #define DTLS_CT_HANDSHAKE 22 /* Content Type Handshake */ |
| #define DTLS_HT_CLIENT_HELLO 1 /* Client Hello handshake type */ |
| #define INET6_ADDRSTRLEN 40 |
| #define OFF_CONTENT_TYPE 0 /* offset of content_type in dtls_record_handshake_t */ |
| #define OFF_HANDSHAKE_TYPE 13 /* offset of handshake in dtls_record_handshake_t */ |
| coap_session_t* coap_endpoint_get_session | ( | coap_endpoint_t * | endpoint, |
| const coap_packet_t * | packet, | ||
| coap_tick_t | now | ||
| ) |
Definition at line 460 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_endpoint_set_default_mtu | ( | coap_endpoint_t * | endpoint, |
| unsigned | mtu | ||
| ) |
Set the endpoint's default MTU.
This is the maximum message size that can be sent, excluding IP and UDP overhead.
| endpoint | The CoAP endpoint. |
| mtu | maximum message size |
Definition at line 1001 of file coap_session.c.
| void coap_free_endpoint | ( | coap_endpoint_t * | ep | ) |
Definition at line 1006 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 97 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_session_t* coap_new_client_session | ( | struct coap_context_t * | ctx, |
| const coap_address_t * | local_if, | ||
| const coap_address_t * | server, | ||
| coap_proto_t | proto | ||
| ) |
Creates a new client session to the designated server.
| ctx | The CoAP context. |
| local_if | Address of local interface. It is recommended to use NULL to let the operating system choose a suitable local interface. If an address is specified, the port number should be zero, which means that a free port is automatically selected. |
| server | The server's address. If the port number is zero, the default port for the protocol will be used. |
| proto | Protocol. |
Definition at line 766 of file coap_session.c.
Here is the call graph for this function:| coap_session_t* coap_new_client_session_pki | ( | struct coap_context_t * | ctx, |
| const coap_address_t * | local_if, | ||
| const coap_address_t * | server, | ||
| coap_proto_t | proto, | ||
| struct coap_dtls_pki_t * | setup_data | ||
| ) |
Creates a new client session to the designated server with PKI credentials.
| ctx | The CoAP context. |
| local_if | Address of local interface. It is recommended to use NULL to let the operating system choose a suitable local interface. If an address is specified, the port number should be zero, which means that a free port is automatically selected. |
| server | The server's address. If the port number is zero, the default port for the protocol will be used. |
| proto | CoAP Protocol. |
| setup_data | PKI parameters. |
Definition at line 841 of file coap_session.c.
Here is the call graph for this function:| coap_session_t* coap_new_client_session_psk | ( | struct coap_context_t * | ctx, |
| const coap_address_t * | local_if, | ||
| const coap_address_t * | server, | ||
| coap_proto_t | proto, | ||
| const char * | identity, | ||
| const uint8_t * | key, | ||
| unsigned | key_len | ||
| ) |
Creates a new client session to the designated server with PSK credentials.
| ctx | The CoAP context. |
| local_if | Address of local interface. It is recommended to use NULL to let the operating system choose a suitable local interface. If an address is specified, the port number should be zero, which means that a free port is automatically selected. |
| server | The server's address. If the port number is zero, the default port for the protocol will be used. |
| proto | Protocol. |
| identity | PSK client identity |
| key | PSK shared key |
| key_len | PSK shared key length |
Definition at line 781 of file coap_session.c.
Here is the call graph for this function:| coap_endpoint_t* coap_new_endpoint | ( | struct coap_context_t * | context, |
| const coap_address_t * | listen_addr, | ||
| coap_proto_t | proto | ||
| ) |
Create a new endpoint for communicating with peers.
| context | The coap context that will own the new endpoint |
| listen_addr | Address the endpoint will listen for incoming requests on or originate outgoing requests from. Use NULL to specify that no incoming request will be accepted and use a random endpoint. |
| proto | Protocol used on this endpoint |
Definition at line 918 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_session_t* coap_new_server_session | ( | struct coap_context_t * | ctx, |
| struct coap_endpoint_t * | ep | ||
| ) |
Creates a new server session for the specified endpoint.
| ctx | The CoAP context. |
| ep | An endpoint where an incoming connection request is pending. |
Definition at line 881 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 739 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 695 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_session_connected | ( | coap_session_t * | session | ) |
Notify session that it has just connected or reconnected.
| session | The CoAP session. |
Definition at line 330 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 642 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t coap_session_delay_pdu | ( | coap_session_t * | session, |
| coap_pdu_t * | pdu, | ||
| coap_queue_t * | node | ||
| ) |
Definition at line 251 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_session_disconnected | ( | coap_session_t * | session, |
| coap_nack_reason_t | reason | ||
| ) |
Notify session that it has failed.
| session | The CoAP session. |
| reason | The reason why the session was disconnected. |
Definition at line 387 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_session_free | ( | coap_session_t * | session | ) |
Definition at line 168 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_fixed_point_t coap_session_get_ack_random_factor | ( | coap_session_t * | session | ) |
Get the CoAP ack randomize factor.
A factor that is used to randomize the wait time before a message is retransmitted to prevent synchronization effects.
| session | The CoAP session. |
Definition at line 63 of file coap_session.c.
| coap_fixed_point_t coap_session_get_ack_timeout | ( | coap_session_t * | session | ) |
Get the CoAP initial ack response timeout before the next re-transmit.
Number of seconds when to expect an ACK or a response to an outstanding CON message.
| session | The CoAP session. |
Definition at line 58 of file coap_session.c.
| void* coap_session_get_app_data | ( | const coap_session_t * | session | ) |
Returns any application-specific data that has been stored with session using the function coap_session_set_app_data().
This function will return NULL if no data has been stored.
Definition at line 91 of file coap_session.c.
| coap_session_t* coap_session_get_by_peer | ( | coap_context_t * | ctx, |
| const coap_address_t * | remote_addr, | ||
| int | ifindex | ||
| ) |
| unsigned int coap_session_get_max_transmit | ( | coap_session_t * | session | ) |
Get the CoAP maximum retransmit before failure.
Number of message retransmissions before message sending is stopped
| session | The CoAP session. |
Definition at line 53 of file coap_session.c.
| size_t coap_session_max_pdu_size | ( | const coap_session_t * | session | ) |
Get maximum acceptable PDU size.
| session | The CoAP session. |
Definition at line 187 of file coap_session.c.
Here is the caller graph for this function:| void coap_session_mfree | ( | coap_session_t * | session | ) |
Definition at line 145 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_session_t* coap_session_reference | ( | coap_session_t * | session | ) |
Increment reference counter on a session.
| session | The CoAP session. |
Definition at line 68 of file coap_session.c.
Here is the caller graph for this function:| void coap_session_release | ( | coap_session_t * | session | ) |
Decrement reference counter on a session.
Note that the session may be deleted as a result and should not be used after this call.
| session | The CoAP session. |
Definition at line 74 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t coap_session_send | ( | coap_session_t * | session, |
| const uint8_t * | data, | ||
| size_t | datalen | ||
| ) |
Function interface for datagram data transmission.
This function returns the number of bytes that have been transmitted, or a value less than zero on error.
| session | Session to send data on. |
| data | The data to send. |
| datalen | The actual length of data. |
Definition at line 216 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_session_send_csm | ( | coap_session_t * | session | ) |
Notify session transport has just connected and CSM exchange can now start.
| session | The CoAP session. |
Definition at line 288 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_tid_t coap_session_send_ping | ( | coap_session_t * | session | ) |
Send a ping message for the session.
| session | The CoAP session. |
Definition at line 314 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_session_set_ack_random_factor | ( | coap_session_t * | session, |
| coap_fixed_point_t | value | ||
| ) |
Set the CoAP ack randomize factor.
A factor that is used to randomize the wait time before a message is retransmitted to prevent synchronization effects.
| session | The CoAP session. |
| value | The value to set to. The default is 1.5 and should not normally get changed. |
Definition at line 42 of file coap_session.c.
Here is the call graph for this function:| void coap_session_set_ack_timeout | ( | coap_session_t * | session, |
| coap_fixed_point_t | value | ||
| ) |
Set the CoAP initial ack response timeout before the next re-transmit.
Number of seconds when to expect an ACK or a response to an outstanding CON message.
| session | The CoAP session. |
| value | The value to set to. The default is 2 and should not normally get changed. |
Definition at line 32 of file coap_session.c.
Here is the call graph for this function:| void coap_session_set_app_data | ( | coap_session_t * | session, |
| void * | data | ||
| ) |
Stores data with the given session.
This function overwrites any value that has previously been stored with session.
Definition at line 85 of file coap_session.c.
| void coap_session_set_max_retransmit | ( | coap_session_t * | session, |
| unsigned int | value | ||
| ) |
Set the CoAP maximum retransmit count before failure.
Number of message retransmissions before message sending is stopped
| session | The CoAP session. |
| value | The value to set to. The default is 4 and should not normally get changed. |
Definition at line 23 of file coap_session.c.
Here is the call graph for this function:| void coap_session_set_mtu | ( | coap_session_t * | session, |
| unsigned | mtu | ||
| ) |
Set the session MTU.
This is the maximum message size that can be sent, excluding IP and UDP overhead.
| session | The CoAP session. |
| mtu | maximum message size |
Definition at line 204 of file coap_session.c.
Here is the caller graph for this function:| ssize_t coap_session_write | ( | coap_session_t * | session, |
| const uint8_t * | data, | ||
| size_t | datalen | ||
| ) |
Function interface for stream data transmission.
This function returns the number of bytes that have been transmitted, or a value less than zero on error. The number of bytes written may be less than datalen because of congestion control.
| session | Session to send data on. |
| data | The data to send. |
| datalen | The actual length of data. |
Definition at line 237 of file coap_session.c.
Here is the call graph for this function:
Here is the caller graph for this function: