1/* 2 * Copyright 2018 Alistair Leslie-Hughes 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18import "oaidl.idl"; 19import "ocidl.idl"; 20 21#if !defined(progid) && !defined(__WIDL__) 22#define threading(model) 23#define progid(str) 24#define vi_progid(str) 25#endif 26 27[ 28 object, 29 uuid(6F10711F-729B-41E5-93B8-F21D0F818DF1), 30 dual, 31 pointer_default(unique) 32] 33interface IStaticPortMapping : IDispatch 34{ 35 [propget, id(1)] 36 HRESULT ExternalIPAddress ([out, retval] BSTR *value); 37 38 [propget, id(2)] 39 HRESULT ExternalPort([out, retval] long *value); 40 41 [propget, id(3)] 42 HRESULT InternalPort([out, retval] long *value); 43 44 [propget, id(4)] 45 HRESULT Protocol([out, retval] BSTR *value); 46 47 [propget, id(5)] 48 HRESULT InternalClient([out, retval] BSTR *value); 49 50 [propget, id(6)] 51 HRESULT Enabled([out, retval] VARIANT_BOOL *value); 52 53 [propget, id(7)] 54 HRESULT Description([out, retval] BSTR *value); 55 56 [id(8)] 57 HRESULT EditInternalClient ([in] BSTR client); 58 59 [id(9)] 60 HRESULT Enable ([in] VARIANT_BOOL enable); 61 62 [id(10)] 63 HRESULT EditDescription ([in] BSTR description); 64 65 [id(11)] 66 HRESULT EditInternalPort ([in] long port); 67}; 68 69[ 70 object, 71 uuid(cd1f3e77-66d6-4664-82c7-36dbb641d0f1), 72 dual, 73 pointer_default(unique) 74] 75interface IStaticPortMappingCollection : IDispatch 76{ 77 [propget, id(DISPID_NEWENUM), hidden, restricted] 78 HRESULT _NewEnum([out, retval] IUnknown **value); 79 80 [propget, id(DISPID_VALUE)] 81 HRESULT Item([in] long port, [in] BSTR protocol, [out, retval] IStaticPortMapping **mapping); 82 83 [propget, id(1)] 84 HRESULT Count([out, retval] long *value); 85 86 [id(2)] 87 HRESULT Remove([in] long port, [in] BSTR protocol); 88 89 [id(3)] 90 HRESULT Add([in] long external, [in] BSTR protocol, [in] long internal, [in] BSTR client, 91 [in] VARIANT_BOOL enabled, [in] BSTR description, [out, retval] IStaticPortMapping **mapping); 92}; 93 94[ 95 object, 96 uuid(4FC80282-23B6-4378-9A27-CD8F17C9400C), 97 dual, 98 pointer_default(unique) 99] 100interface IDynamicPortMapping : IDispatch 101{ 102 [propget, id(1)] 103 HRESULT ExternalIPAddress ([out, retval] BSTR *value); 104 105 [propget, id(2)] 106 HRESULT RemoteHost ([out, retval] BSTR *value); 107 108 [propget, id(3)] 109 HRESULT ExternalPort([out, retval] long *value); 110 111 [propget, id(4)] 112 HRESULT Protocol([out, retval] BSTR *value); 113 114 [propget, id(5)] 115 HRESULT InternalPort([out, retval] long *value); 116 117 [propget, id(6)] 118 HRESULT InternalClient([out, retval] BSTR *value); 119 120 [propget, id(7)] 121 HRESULT Enabled([out, retval] VARIANT_BOOL *value); 122 123 [propget, id(8)] 124 HRESULT Description([out, retval] BSTR *value); 125 126 [propget, id(9)] 127 HRESULT LeaseDuration([out, retval] long *value); 128 129 [id(10)] 130 HRESULT RenewLease([in] long desired, [out, retval] long *duration); 131 132 [id(11)] 133 HRESULT EditInternalClient ([in] BSTR client); 134 135 [id(12)] 136 HRESULT Enable ([in] VARIANT_BOOL enabled); 137 138 [id(13)] 139 HRESULT EditDescription ([in] BSTR description); 140 141 [id(14)] 142 HRESULT EditInternalPort ([in] long port); 143}; 144 145[ 146 object, 147 uuid(b60de00f-156e-4e8d-9ec1-3a2342c10899), 148 dual, 149 pointer_default(unique) 150] 151interface IDynamicPortMappingCollection : IDispatch 152{ 153 [propget, id(DISPID_NEWENUM), hidden, restricted] 154 HRESULT _NewEnum([out, retval] IUnknown **value); 155 156 [propget, id(DISPID_VALUE)] 157 HRESULT Item([in] BSTR host, [in] long port, [in] BSTR orotocol, 158 [out, retval] IDynamicPortMapping **mapping); 159 160 [propget, id(1)] 161 HRESULT Count([out, retval] long *value); 162 163 [id(2)] 164 HRESULT Remove([in] BSTR host, [in] long port, [in] BSTR protocol); 165 166 [id(3)] 167 HRESULT Add([in] BSTR host, [in] long port, [in] BSTR protocol, [in] long internal, 168 [in] BSTR client, [in] VARIANT_BOOL enabled, [in] BSTR Description, 169 [in] long duration, [out, retval] IDynamicPortMapping **mapping); 170}; 171 172[ 173 object, 174 uuid(624bd588-9060-4109-b0b0-1adbbcac32df), 175 dual, 176 pointer_default(unique) 177] 178interface INATEventManager : IDispatch 179{ 180 [id(1), propput] 181 HRESULT ExternalIPAddressCallback ([in] IUnknown *unk); 182 183 [id(2), propput] 184 HRESULT NumberOfEntriesCallback ([in] IUnknown *unk); 185}; 186 187[ 188 object, 189 uuid(b171c812-cc76-485a-94d8-b6b3a2794e99), 190 dual, 191 pointer_default(unique) 192] 193interface IUPnPNAT : IDispatch 194{ 195 [propget, id(1)] 196 HRESULT StaticPortMappingCollection ([out, retval] IStaticPortMappingCollection **collection); 197 198 [propget, id(2)] 199 HRESULT DynamicPortMappingCollection ([out, retval] IDynamicPortMappingCollection **collection); 200 201 [propget, id(3)] 202 HRESULT NATEventManager ([out, retval] INATEventManager **manager); 203}; 204 205[ 206 id(2), 207 uuid(1c565858-f302-471e-b409-f180aa4abec6), 208 version(1.0) 209] 210library NATUPNPLib 211{ 212 importlib("stdole2.tlb"); 213 214 [ 215 vi_progid("HNetCfg.NATUPnP"), 216 progid("HNetCfg.NATUPnP.1"), 217 threading(apartment), 218 uuid(ae1e00aa-3fd5-403c-8a27-2bbdc30cd0e1) 219 ] 220 coclass UPnPNAT 221 { 222 [default] interface IUPnPNAT; 223 }; 224}; 225