|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Go to the source code of this file.
Data Structures | |
| struct | asciichat_mdns_service_t |
| Service information for advertisement. More... | |
| struct | asciichat_mdns_discovery_t |
| Discovered service information. More... | |
Typedefs | |
| typedef struct asciichat_mdns_t | asciichat_mdns_t |
| opaque mDNS context handle | |
| typedef void(* | asciichat_mdns_discovery_callback_fn) (const asciichat_mdns_discovery_t *service, void *user_data) |
| Callback for discovered services. | |
Functions | |
| asciichat_mdns_t * | asciichat_mdns_init (void) |
| Initialize mDNS context. | |
| void | asciichat_mdns_shutdown (asciichat_mdns_t *mdns) |
| Shutdown mDNS context and cleanup. | |
| asciichat_error_t | asciichat_mdns_advertise (asciichat_mdns_t *mdns, const asciichat_mdns_service_t *service) |
| Advertise a service on the local network. | |
| asciichat_error_t | asciichat_mdns_unadvertise (asciichat_mdns_t *mdns, const char *service_name) |
| Stop advertising a service. | |
| asciichat_error_t | asciichat_mdns_query (asciichat_mdns_t *mdns, const char *service_type, asciichat_mdns_discovery_callback_fn callback, void *user_data) |
| Query for services on the local network. | |
| asciichat_error_t | asciichat_mdns_update (asciichat_mdns_t *mdns, int timeout_ms) |
| Process pending mDNS events (must be called regularly) | |
| int | asciichat_mdns_get_socket (asciichat_mdns_t *mdns) |
| Get the socket file descriptor for integration with select/poll. | |
| typedef void(* asciichat_mdns_discovery_callback_fn) (const asciichat_mdns_discovery_t *service, void *user_data) |
| typedef struct asciichat_mdns_t asciichat_mdns_t |
| asciichat_error_t asciichat_mdns_advertise | ( | asciichat_mdns_t * | mdns, |
| const asciichat_mdns_service_t * | service | ||
| ) |
Advertise a service on the local network.
| mdns | mDNS context |
| service | Service to advertise |
Definition at line 75 of file mdns.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, asciichat_mdns_service_t::host, log_info, asciichat_mdns_service_t::name, asciichat_mdns_service_t::port, SET_ERRNO, and asciichat_mdns_service_t::type.
Referenced by main().
| int asciichat_mdns_get_socket | ( | asciichat_mdns_t * | mdns | ) |
Get the socket file descriptor for integration with select/poll.
| mdns | mDNS context |
Definition at line 279 of file mdns.c.
References asciichat_mdns_t::socket_fd.
| asciichat_mdns_t * asciichat_mdns_init | ( | void | ) |
Initialize mDNS context.
Definition at line 30 of file mdns.c.
References asciichat_mdns_t::buffer, asciichat_mdns_t::buffer_capacity, ERROR_MEMORY, ERROR_NETWORK_BIND, log_info, MDNS_BUFFER_SIZE, SAFE_FREE, SAFE_MALLOC, SET_ERRNO, and asciichat_mdns_t::socket_fd.
Referenced by discovery_mdns_query(), main(), and server_main().
| asciichat_error_t asciichat_mdns_query | ( | asciichat_mdns_t * | mdns, |
| const char * | service_type, | ||
| asciichat_mdns_discovery_callback_fn | callback, | ||
| void * | user_data | ||
| ) |
Query for services on the local network.
| mdns | mDNS context |
| service_type | Service type to query (e.g., "_ascii-chat._tcp.local") |
| callback | Function to call for each discovered service |
| user_data | User pointer passed to callback |
Definition at line 219 of file mdns.c.
References ASCIICHAT_OK, asciichat_mdns_t::buffer, asciichat_mdns_t::buffer_capacity, asciichat_mdns_t::callback, asciichat_mdns_t::callback_data, ERROR_INVALID_PARAM, ERROR_NETWORK, log_debug, log_info, asciichat_mdns_t::query_id, SET_ERRNO, and asciichat_mdns_t::socket_fd.
Referenced by discovery_mdns_query().
| void asciichat_mdns_shutdown | ( | asciichat_mdns_t * | mdns | ) |
Shutdown mDNS context and cleanup.
| mdns | Context to cleanup |
Definition at line 61 of file mdns.c.
References asciichat_mdns_t::buffer, log_info, SAFE_FREE, and asciichat_mdns_t::socket_fd.
Referenced by discovery_mdns_query(), main(), and server_main().
| asciichat_error_t asciichat_mdns_unadvertise | ( | asciichat_mdns_t * | mdns, |
| const char * | service_name | ||
| ) |
Stop advertising a service.
| mdns | mDNS context |
| service_name | Service instance name to unadvertise |
Definition at line 93 of file mdns.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, log_info, and SET_ERRNO.
| asciichat_error_t asciichat_mdns_update | ( | asciichat_mdns_t * | mdns, |
| int | timeout_ms | ||
| ) |
Process pending mDNS events (must be called regularly)
This should be called from the main event loop to:
| mdns | mDNS context |
| timeout_ms | Maximum time to block (0 = non-blocking) |
Definition at line 255 of file mdns.c.
References ASCIICHAT_OK, asciichat_mdns_t::buffer, asciichat_mdns_t::buffer_capacity, ERROR_INVALID_PARAM, ERROR_NETWORK, log_debug, asciichat_mdns_t::query_id, SET_ERRNO, and asciichat_mdns_t::socket_fd.
Referenced by discovery_mdns_query().