![]() |
Defines | |
#define | NUT_THREAD_DISTSTACK 512 |
#define | DISCOVERY_PORT 9806 |
Functions | |
int | NutDiscoveryAnnTele (DISCOVERY_TELE *dist) |
Create an announcement datagram. | |
int | NutDiscoveryAppConf (DISCOVERY_TELE *dist) |
Apply new configuration. | |
void | DiscoveryResponder (void *arg) |
NutDiscoveryCallback | NutRegisterDiscoveryCallback (NutDiscoveryCallback func) |
Register a custom discovery callback handler. | |
int | NutRegisterDiscovery (u_long ipmask, u_short port, u_int flags) |
Register discovery telegram responder. |
#define NUT_THREAD_DISTSTACK 512 |
#define DISCOVERY_PORT 9806 |
int NutDiscoveryAnnTele | ( | DISCOVERY_TELE * | dist | ) |
Create an announcement datagram.
dist | Pointer to the datagram buffer that will be filled. |
Definition at line 91 of file discover.c.
References _CONFNET::cdn_cip_addr, _CONFNET::cdn_gateway, _CONFNET::cdn_ip_addr, _CONFNET::cdn_ip_mask, _CONFNET::cdn_mac, confnet, confos, DISCOVERY_VERSION, DIST_ANNOUNCE, _DISCOVERY_TELE::dist_cip_addr, _DISCOVERY_TELE::dist_custom, _DISCOVERY_TELE::dist_gateway, _DISCOVERY_TELE::dist_hostname, _DISCOVERY_TELE::dist_ip_addr, _DISCOVERY_TELE::dist_ip_mask, _DISCOVERY_TELE::dist_mac, _DISCOVERY_TELE::dist_type, _DISCOVERY_TELE::dist_ver, _DISCOVERY_TELE::dist_xid, _CONFOS::hostname, memcpy(), and memset().
Referenced by DiscoveryResponder().
int NutDiscoveryAppConf | ( | DISCOVERY_TELE * | dist | ) |
Apply new configuration.
dist | Pointer to the discovery datagram. It is assumed, that the validity of the datagram contents had been checked by the caller. |
Definition at line 114 of file discover.c.
References _CONFNET::cdn_cip_addr, _CONFNET::cdn_gateway, _CONFNET::cdn_ip_addr, _CONFNET::cdn_ip_mask, _CONFNET::cdn_mac, confnet, confos, _DISCOVERY_TELE::dist_cip_addr, _DISCOVERY_TELE::dist_gateway, _DISCOVERY_TELE::dist_hostname, _DISCOVERY_TELE::dist_ip_addr, _DISCOVERY_TELE::dist_ip_mask, _DISCOVERY_TELE::dist_mac, _CONFOS::hostname, memcpy(), NutNetSaveConfig(), and NutSaveConfig().
void DiscoveryResponder | ( | void * | arg | ) |
Definition at line 156 of file discover.c.
References _CONFNET::cdn_ip_addr, _CONFNET::cdn_ip_mask, _CONFNET::cdn_mac, confnet, DISF_INITAL_ANN, INADDR_BROADCAST, malloc, memcpy(), NutDiscoveryAnnTele(), NutGetTickCount(), NutSleep(), NutUdpCreateSocket(), NutUdpReceiveFrom(), NutUdpSendTo(), NutUdpSetSockOpt(), and SO_RCVBUF.
Referenced by NutRegisterDiscovery().
NutDiscoveryCallback NutRegisterDiscoveryCallback | ( | NutDiscoveryCallback | func | ) |
Register a custom discovery callback handler.
When a callback had been registered, all datagrams matching the IP mask are passed to this function, which should inspect the datagram contents and take any required action like calling NutDiscoveryAnnTele() etc. If the callback returns a positive value, a response will be sent back, using that return value as its length.
func | Pointer to the callback function or NULL to disable responses. |
Definition at line 226 of file discover.c.
Register discovery telegram responder.
The first call will activate the responder thread. Any subsequent calls will return a failure.
ipmask | Update datagrams from remote hosts, which do not fit to this mask are ignored. Set to INADDR_BROADCAST to allow any. If zero, no updates are allowed. | |
port | The responder will listen to this UDP port. If zero, the default port 9806 will be used. | |
flags | Option value, may contain any combination of DISF_ flags. |
Definition at line 252 of file discover.c.
References DISCOVERY_PORT, DiscoveryResponder(), NUT_THREAD_DISTSTACK, and NutThreadCreate().
Referenced by main().