ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
network/mdns/mdns.h
Go to the documentation of this file.
1#pragma once
2
3/* Storage capacities in elements; text buffers include the terminating NUL. */
4#define NETWORK_MDNS_NAME_BUFFER_SIZE 256
5#define NETWORK_MDNS_TYPE_BUFFER_SIZE 256
6#define NETWORK_MDNS_IPV4_BUFFER_SIZE 16
7#define NETWORK_MDNS_IPV6_BUFFER_SIZE 46
8#define NETWORK_MDNS_TXT_BUFFER_SIZE 512
9
11
57
58#include <stdint.h>
59#include <stdlib.h>
60#include <stdbool.h>
61#include "../../common.h"
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
69
73typedef struct {
75 const char *name;
79 const char *type;
81 const char *host;
83 const char **txt_records;
85 size_t txt_count;
87
110
118typedef void (*asciichat_mdns_discovery_callback_fn)(const asciichat_mdns_discovery_t *service, void *user_data);
119
126
133
145
153asciichat_error_t asciichat_mdns_unadvertise(asciichat_mdns_t *mdns, const char *service_name);
154
164asciichat_error_t asciichat_mdns_query(asciichat_mdns_t *mdns, const char *service_type,
165 asciichat_mdns_discovery_callback_fn callback, void *user_data);
166
180
190
191#ifdef __cplusplus
192}
193#endif
Application limits and constraints.
⚙️ Common definitions, error codes, macros, and types shared throughout the application
unsigned short uint16_t
Definition common.h:61
unsigned int uint32_t
Definition common.h:62
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
#define HOSTNAME_BUFFER_SIZE
asciichat_error_t asciichat_mdns_update(asciichat_mdns_t *mdns, int timeout_ms)
Process pending mDNS events (must be called regularly).
#define NETWORK_MDNS_TXT_BUFFER_SIZE
asciichat_error_t asciichat_mdns_unadvertise(asciichat_mdns_t *mdns, const char *service_name)
Stop advertising a service.
#define NETWORK_MDNS_NAME_BUFFER_SIZE
void asciichat_mdns_destroy(asciichat_mdns_t *mdns)
Shutdown mDNS context and cleanup.
void(* asciichat_mdns_discovery_callback_fn)(const asciichat_mdns_discovery_t *service, void *user_data)
This is the handoff point for asciichat mdns discovery. Callers fill port, ttl before passing it on; ...
#define NETWORK_MDNS_IPV6_BUFFER_SIZE
#define NETWORK_MDNS_TYPE_BUFFER_SIZE
asciichat_mdns_t * asciichat_mdns_init(void)
Initialize mDNS context.
int asciichat_mdns_get_socket(asciichat_mdns_t *mdns)
Get the socket file descriptor for integration with select/poll.
#define NETWORK_MDNS_IPV4_BUFFER_SIZE
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_advertise(asciichat_mdns_t *mdns, const asciichat_mdns_service_t *service)
Advertise a service on the local network.
Service information for advertisement.
Service information for advertisement.
Owns one mDNS browse or advertisement session, including its socket, event-loop registration,...