sock utility function
More...
sock utility function
|
file | util.h |
| sock utility function definitions
|
|
◆ HAVE_SOCK_TL_EP
#define HAVE_SOCK_TL_EP 1 |
◆ SOCK_HAS_TCP
TCP support is enabled.
Definition at line 38 of file util.h.
◆ SOCK_HAS_UDP
UDP support is enabled.
Definition at line 34 of file util.h.
◆ sock_dtls_establish_session()
Helper function to establish a DTLS connection.
- Parameters
-
[out] | sock_udp | Struct to store the underlying UDP socket |
[out] | sock_dtls | Struct for the actual DTLS socket |
[out] | session | Struct to store DTLS session information |
[in] | tag | Credential tag to use |
[in] | local | Local endpoint, must not be NULL |
[in] | remote | Server endpoint to connect to |
[in] | work_buf | Buffer used to negotiate connection |
[in] | work_buf_len | Size of work buf. Should be at least 160 bytes for AES_128_CCM_8 with PSK |
- Returns
- 0 on success
-
negative error otherwise (see sock_dtls_recv_aux)
◆ sock_urlpath()
const char * sock_urlpath |
( |
const char * | url | ) |
|
Returns a pointer to the path component in url
.
- Parameters
-
[in] | url | URL to examine. Must not be NULL. |
- Returns
- pointer to the start of the path component in
url
-
NULL if
url
is invalid
◆ sock_urlsplit()
int sock_urlsplit |
( |
const char * | url, |
|
|
char * | hostport, |
|
|
char * | urlpath ) |
Split url to host:port and url path.
Will split e.g., "https://host.name:1234/url/path" into "host.name:1234" and "/url/path".
- Note
- Caller has to make sure hostport and urlpath can hold the results! Make sure to provide space for CONFIG_SOCK_HOSTPORT_MAXLEN respectively CONFIG_SOCK_URLPATH_MAXLEN bytes, if pointers are not NULL. Scheme part of the URL is limited to CONFIG_SOCK_SCHEME_MAXLEN length.
- Precondition
url != NULL
- Parameters
-
[in] | url | URL to split. Must not be NULL. |
[out] | hostport | where to write host:port. Can be NULL. |
[out] | urlpath | where to write url path. Can be NULL. |
- Returns
- 0 on success
-
<0 otherwise