|
|
void * | app |
| | user-supplied context
|
| int(* | time_now )(jdns_session_t *s, void *app) |
| int(* | rand_int )(jdns_session_t *s, void *app) |
| void(* | debug_line )(jdns_session_t *s, void *app, const char *str) |
| int(* | udp_bind )(jdns_session_t *s, void *app, const jdns_address_t *addr, int port, const jdns_address_t *maddr) |
| void(* | udp_unbind )(jdns_session_t *s, void *app, int handle) |
| int(* | udp_read )(jdns_session_t *s, void *app, int handle, jdns_address_t *addr, int *port, unsigned char *buf, int *bufsize) |
| int(* | udp_write )(jdns_session_t *s, void *app, int handle, const jdns_address_t *addr, int port, unsigned char *buf, int bufsize) |
◆ debug_line
| void(* jdns_callbacks::debug_line) (jdns_session_t *s, void *app, const char *str) |
- Parameters
-
| s | session |
| app | user-supplied context |
| str | a line of debug text |
◆ rand_int
| int(* jdns_callbacks::rand_int) (jdns_session_t *s, void *app) |
- Parameters
-
| s | session |
| app | user-supplied context |
- Returns
- random integer between 0-65535
◆ time_now
| int(* jdns_callbacks::time_now) (jdns_session_t *s, void *app) |
- Parameters
-
| s | session |
| app | user-supplied context |
- Returns
- milliseconds since session started
◆ udp_bind
| int(* jdns_callbacks::udp_bind) (jdns_session_t *s, void *app, const jdns_address_t *addr, int port, const jdns_address_t *maddr) |
- Note
- For multicast, the following must be done:
- use SO_REUSEPORT to share with other mdns programs
- use IP_ADD_MEMBERSHIP to associate addr and maddr
- set IP_MULTICAST_TTL to 255
- Parameters
-
| s | session |
| app | user-supplied context |
| addr | ip address of interface to bind to. 0 for all |
| port | port of interface to bind to. 0 for any |
| maddr | multicast address. 0 if not using multicast |
- Returns
- handle (>0) of bound socket, or 0 on error
◆ udp_read
| int(* jdns_callbacks::udp_read) (jdns_session_t *s, void *app, int handle, jdns_address_t *addr, int *port, unsigned char *buf, int *bufsize) |
- Parameters
-
| s | session |
| app | user-supplied context |
| handle | handle of socket obtained with udp_bind |
| addr | store ip address of sender |
| port | store port of sender |
| buf | store packet content |
| bufsize | value contains max size, to be changed to real size |
- Returns
- 1 if packet read, 0 if none available
◆ udp_unbind
| void(* jdns_callbacks::udp_unbind) (jdns_session_t *s, void *app, int handle) |
- Parameters
-
| s | session |
| app | user-supplied context |
| handle | handle of socket obtained with udp_bind |
◆ udp_write
| int(* jdns_callbacks::udp_write) (jdns_session_t *s, void *app, int handle, const jdns_address_t *addr, int port, unsigned char *buf, int bufsize) |
- Parameters
-
| s | session |
| app | user-supplied context |
| handle | handle of socket obtained with udp_bind |
| addr | ip address of recipient |
| port | port of recipient |
| buf | packet content |
| bufsize | size of packet |
- Returns
- 1 if packet taken for writing, 0 if this is a bad time
The documentation for this struct was generated from the following file: