#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "fast_merge_sort.h"
#include "upnphandler.h"
Defines | |
| #define | LESS_THAN_OR_EQUAL_DEV(a, b) ( strcmp( (a)->key, (b)->key) <= 0 ) |
| #define | MSEARCH_DELAY 10 |
| Method:. | |
| #define | MSEARCH_DELAY_STRING "10" |
| #define | REAPER_CYCLE_TIME ((AW_TIMESTAMP_PER_SEC)*5) |
| #define | UPNP_URL_MAX_SIZE 1024 |
| #define | UUID_PREFIX_LEN (sizeof(UUID_PREFIX)-1) |
Functions | |
| aw_upnphandler_t * | aw_create_upnphandler (u_int32_t nregexs, const aw_upnphandler_regex_t *regexs, const byte_t *mcinterface, u_int32_t mcloopback, const aw_alarm_sched_t *sched, aw_logger_t *logger) |
| Create a upnphandler. | |
| void | aw_free_upnphandler (aw_upnphandler_t *h) |
| Free handler and all associated resources. | |
| aw_handler_t * | aw_wire_upnphandler (aw_wire_mkhandler_args_t *args) |
| Create a upnp handler using "wire". See header doc for keyword documentation. | |
|
|
|
|
|
Method:. At start, create a sorted list of all USNs, these become the 'up' list. This is done by sending an M-SEARCH message and waiting MSEARCH_DELAY for responses. Since the same record may come multiple times, keep sure the list has all unique records. Regex match the 'up' list, remember those that matched and their 'command' in a 'watch' list. Each poll interval:
Between poll intervals:
Register to receive signals when there is new data on the 239.255.255.250:1900 socket: M-SEARCH (*) -> reply with appropriate Search Response with URL w/configured IP/name to deliver device description on this system NOTIFY (ssdb:alive) -> generate an 'up' event, add to 'up' list, if match regex, add to watch list NOTIFY (ssdb:byebye) -> generate an 'down' event, remove from 'up' list, if match regex, remove from watch list [NOTE: Still to do ] Register to receive signals when there is new data on the device description socket: GET w/URL -> xml data |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||||||
|
Create a upnphandler. aw_create_upnphandler
|
|
|
Free handler and all associated resources. aw_free_upnphandler
|
|
|
Create a upnp handler using "wire". See header doc for keyword documentation. aw_wire_upnphandler |