Local endpoint creation and configuration.
More...
|
| struct | ct_local_endpoint_t |
| | Opaque handle representing a local endpoint (generic or resolved to specific ip address and port). More...
|
| |
Local endpoint creation and configuration.
◆ ct_local_endpoint_deep_copy()
Create a heap-allocated copy of a local endpoint.
- Parameters
-
| [in] | local_endpoint | Source endpoint |
- Returns
- Pointer to newly allocated copy, or NULL on error
◆ ct_local_endpoint_free()
Free all resources in a local endpoint including the structure itself.
- Parameters
-
| [in] | local_endpoint | Endpoint to free |
◆ ct_local_endpoint_from_sockaddr()
| int ct_local_endpoint_from_sockaddr |
( |
ct_local_endpoint_t * |
local_endpoint, |
|
|
const struct sockaddr_storage * |
addr |
|
) |
| |
Initialize a local endpoint from a sockaddr structure.
CTaps does not take ownership of the passed addr pointer, so it can be safely freed after return.
- Parameters
-
| [out] | local_endpoint | Endpoint to initialize |
| [in] | addr | Socket address structure |
- Returns
- 0 on success, negative error code on failure
◆ ct_local_endpoint_get_resolved_port()
Get the resolved port for a local endpoint after binding.
- Returns
- Port number assigned to the local endpoint in host order
◆ ct_local_endpoint_get_service()
Get the service for a local endpoint.
- Parameters
-
| [in] | local_endpoint | endpoint to get service for |
- Returns
- char* pointer to service name, NULL if endpoint is null, or if service is not set
◆ ct_local_endpoint_new()
Create a new heap-allocated local endpoint.
The caller owns the returned endpoint and must free it with ct_local_endpoint_free() when done.
- Returns
- Pointer to newly allocated endpoint, or NULL on error
◆ ct_local_endpoint_with_interface()
| int ct_local_endpoint_with_interface |
( |
ct_local_endpoint_t * |
local_endpoint, |
|
|
const char * |
interface_name |
|
) |
| |
Set the network interface for a local endpoint.
- Parameters
-
| [in,out] | local_endpoint | Endpoint to modify |
| [in] | interface_name | Interface name (e.g., "eth0", "wlan0") |
- Returns
- 0 on success, negative error code on failure
◆ ct_local_endpoint_with_ipv4()
Set the IPv4 address for a local endpoint.
- Parameters
-
| [in,out] | local_endpoint | Endpoint to modify |
| [in] | ipv4_addr | IPv4 address in network byte order |
- Returns
- 0 on success, negative error code on failure
◆ ct_local_endpoint_with_ipv6()
| int ct_local_endpoint_with_ipv6 |
( |
ct_local_endpoint_t * |
local_endpoint, |
|
|
struct in6_addr |
ipv6_addr |
|
) |
| |
Set the IPv6 address for a local endpoint.
- Parameters
-
| [in,out] | local_endpoint | Endpoint to modify |
| [in] | ipv6_addr | IPv6 address in network byte order |
- Returns
- 0 on success, negative error code on failure
◆ ct_local_endpoint_with_port()
Set the port number for a local endpoint.
- Parameters
-
| [in,out] | local_endpoint | Endpoint to modify |
| [in] | port | Port number |
◆ ct_local_endpoint_with_service()
| int ct_local_endpoint_with_service |
( |
ct_local_endpoint_t * |
local_endpoint, |
|
|
const char * |
service |
|
) |
| |
Set the service name for a local endpoint.
Takes a deep copy of the provided string.
- Parameters
-
| [in,out] | local_endpoint | Endpoint to modify |
| [in] | service | Service name (e.g., "http", "https") |
- Returns
- 0 on success, negative error code on failure