SsdpConstants.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. namespace Rssdp.Infrastructure
  6. {
  7. /// <summary>
  8. /// Provides constants for common values related to the SSDP protocols.
  9. /// </summary>
  10. public static class SsdpConstants
  11. {
  12. /// <summary>
  13. /// Multicast IP Address used for SSDP multicast messages. Values is 239.255.255.250.
  14. /// </summary>
  15. public const string MulticastLocalAdminAddress = "239.255.255.250";
  16. /// <summary>
  17. /// The UDP port used for SSDP multicast messages. Values is 1900.
  18. /// </summary>
  19. public const int MulticastPort = 1900;
  20. /// <summary>
  21. /// The default multicase TTL for SSDP multicast messages. Value is 4.
  22. /// </summary>
  23. public const int SsdpDefaultMulticastTimeToLive = 4;
  24. internal const string MSearchMethod = "M-SEARCH";
  25. internal const string SsdpDiscoverMessage = "ssdp:discover";
  26. internal const string SsdpDiscoverAllSTHeader = "ssdp:all";
  27. internal const string SsdpDeviceDescriptionXmlNamespace = "urn:schemas-upnp-org:device-1-0";
  28. /// <summary>
  29. /// Default buffer size for receiving SSDP broadcasts. Value is 8192 (bytes).
  30. /// </summary>
  31. public const int DefaultUdpSocketBufferSize = 8192;
  32. /// <summary>
  33. /// The maximum possible buffer size for a UDP message. Value is 65507 (bytes).
  34. /// </summary>
  35. public const int MaxUdpSocketBufferSize = 65507; // Max possible UDP packet size on IPv4 without using 'jumbograms'.
  36. /// <summary>
  37. /// Namespace/prefix for UPnP device types. Values is schemas-upnp-org.
  38. /// </summary>
  39. public const string UpnpDeviceTypeNamespace = "schemas-upnp-org";
  40. /// <summary>
  41. /// UPnP Root Device type. Value is upnp:rootdevice.
  42. /// </summary>
  43. public const string UpnpDeviceTypeRootDevice = "upnp:rootdevice";
  44. /// <summary>
  45. /// The value is used by Windows Explorer for device searches instead of the UPNPDeviceTypeRootDevice constant.
  46. /// Not sure why (different spec, bug, alternate protocol etc). Used to enable Windows Explorer support.
  47. /// </summary>
  48. public const string PnpDeviceTypeRootDevice = "pnp:rootdevice";
  49. /// <summary>
  50. /// UPnP Basic Device type. Value is Basic.
  51. /// </summary>
  52. public const string UpnpDeviceTypeBasicDevice = "Basic";
  53. internal const string SsdpKeepAliveNotification = "ssdp:alive";
  54. internal const string SsdpByeByeNotification = "ssdp:byebye";
  55. internal const int UdpResendCount = 3;
  56. }
  57. }