nsISocketProvider.idl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. interface nsIProxyInfo;
  7. [ptr] native PRFileDescStar(struct PRFileDesc);
  8. native NeckoOriginAttributes(mozilla::NeckoOriginAttributes);
  9. [ref] native const_OriginAttributesRef(const mozilla::NeckoOriginAttributes);
  10. %{ C++
  11. #include "mozilla/BasePrincipal.h"
  12. %}
  13. /**
  14. * nsISocketProvider
  15. */
  16. [scriptable, uuid(508d5469-9e1e-4a08-b5b0-7cfebba1e51a)]
  17. interface nsISocketProvider : nsISupports
  18. {
  19. /**
  20. * newSocket
  21. *
  22. * @param aFamily
  23. * The address family for this socket (PR_AF_INET or PR_AF_INET6).
  24. * @param aHost
  25. * The origin hostname for this connection.
  26. * @param aPort
  27. * The origin port for this connection.
  28. * @param aProxyHost
  29. * If non-null, the proxy hostname for this connection.
  30. * @param aProxyPort
  31. * The proxy port for this connection.
  32. * @param aFlags
  33. * Control flags that govern this connection (see below.)
  34. * @param aFileDesc
  35. * The resulting PRFileDesc.
  36. * @param aSecurityInfo
  37. * Any security info that should be associated with aFileDesc. This
  38. * object typically implements nsITransportSecurityInfo.
  39. */
  40. [noscript]
  41. void newSocket(in long aFamily,
  42. in string aHost,
  43. in long aPort,
  44. in nsIProxyInfo aProxy,
  45. in const_OriginAttributesRef aOriginAttributes,
  46. in unsigned long aFlags,
  47. out PRFileDescStar aFileDesc,
  48. out nsISupports aSecurityInfo);
  49. /**
  50. * addToSocket
  51. *
  52. * This function is called to allow the socket provider to layer a
  53. * PRFileDesc on top of another PRFileDesc. For example, SSL via a SOCKS
  54. * proxy.
  55. *
  56. * Parameters are the same as newSocket with the exception of aFileDesc,
  57. * which is an in-param instead.
  58. */
  59. [noscript]
  60. void addToSocket(in long aFamily,
  61. in string aHost,
  62. in long aPort,
  63. in nsIProxyInfo aProxy,
  64. in const_OriginAttributesRef aOriginAttributes,
  65. in unsigned long aFlags,
  66. in PRFileDescStar aFileDesc,
  67. out nsISupports aSecurityInfo);
  68. /**
  69. * PROXY_RESOLVES_HOST
  70. *
  71. * This flag is set if the proxy is to perform hostname resolution instead
  72. * of the client. When set, the hostname parameter passed when in this
  73. * interface will be used instead of the address structure passed for a
  74. * later connect et al. request.
  75. */
  76. const long PROXY_RESOLVES_HOST = 1 << 0;
  77. /**
  78. * When setting this flag, the socket will not apply any
  79. * credentials when establishing a connection. For example,
  80. * an SSL connection would not send any client-certificates
  81. * if this flag is set.
  82. */
  83. const long ANONYMOUS_CONNECT = 1 << 1;
  84. /**
  85. * If set, indicates that the connection was initiated from a source
  86. * defined as being private in the sense of Private Browsing. Generally,
  87. * there should be no state shared between connections that are private
  88. * and those that are not; it is OK for multiple private connections
  89. * to share state with each other, and it is OK for multiple non-private
  90. * connections to share state with each other.
  91. */
  92. const unsigned long NO_PERMANENT_STORAGE = 1 << 2;
  93. /**
  94. * This flag is an explicit opt-in that allows a normally secure socket
  95. * provider to use, at its discretion, an insecure algorithm. e.g.
  96. * a TLS socket without authentication.
  97. */
  98. const unsigned long MITM_OK = 1 << 3;
  99. /**
  100. * If set, do not use newer protocol features that might have interop problems
  101. * on the Internet. Intended only for use with critical infra like the updater.
  102. * default is false.
  103. */
  104. const unsigned long BE_CONSERVATIVE = 1 << 4;
  105. };
  106. %{C++
  107. /**
  108. * nsISocketProvider implementations should be registered with XPCOM under a
  109. * contract ID of the form: "@mozilla.org/network/socket;2?type=foo"
  110. */
  111. #define NS_NETWORK_SOCKET_CONTRACTID_PREFIX \
  112. "@mozilla.org/network/socket;2?type="
  113. %}