You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* SSDP responder
  2. *
  3. * Copyright (c) 2017 Joachim Nilsson <troglobit@gmail.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.a
  16. */
  17. #ifndef SSDP_H_
  18. #define SSDP_H_
  19. #include <syslog.h>
  20. /* Notify should be less than half the cache timeout */
  21. #define NOTIFY_INTERVAL 300
  22. #define REFRESH_INTERVAL 600
  23. #define CACHE_TIMEOUT 1800
  24. #define MAX_NUM_IFACES 100
  25. #define MAX_PKT_SIZE 2000
  26. #define MC_SSDP_GROUP "239.255.255.250"
  27. #define MC_SSDP_PORT 1900
  28. #define LOCATION_PORT (MC_SSDP_PORT + 1)
  29. #define LOCATION_DESC "/description.xml"
  30. #define SSDP_ST_ALL "ssdp:all"
  31. #define logit(lvl, fmt, args...) syslog(lvl, fmt, ##args)
  32. #define ENABLE_SOCKOPT(sd, level, opt) \
  33. do { \
  34. int val = 1; \
  35. if (setsockopt(sd, level, opt, &val, sizeof(val)) < 0) \
  36. warn("Failed enabling %s for web service", #opt); \
  37. } while (0);
  38. extern int debug;
  39. extern char uuid[];
  40. void web_init(void);
  41. int register_socket(int in, int out, struct sockaddr *addr, struct sockaddr *mask, void (*cb)(int sd));
  42. #endif /* SSDP_H_ */