|
version 1.1.1.1, 2012/02/21 23:16:02
|
version 1.1.1.2, 2012/05/29 12:55:57
|
|
Line 1
|
Line 1
|
| /* $Id$ */ |
/* $Id$ */ |
| /* MiniUPnP project |
/* MiniUPnP project |
| * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
| * (c) 2006-2009 Thomas Bernard | * (c) 2006-2011 Thomas Bernard |
| * This software is subject to the conditions detailed |
* This software is subject to the conditions detailed |
| * in the LICENCE file provided within the distribution */ |
* in the LICENCE file provided within the distribution */ |
| |
|
|
Line 18
|
Line 18
|
| #include "miniupnpdpath.h" |
#include "miniupnpdpath.h" |
| #include "upnpglobalvars.h" |
#include "upnpglobalvars.h" |
| #include "upnpdescstrings.h" |
#include "upnpdescstrings.h" |
| |
#include "upnpurns.h" |
| |
#include "getconnstatus.h" |
| |
|
| |
|
| |
/* Event magical values codes */ |
| |
#define CONNECTIONSTATUS_MAGICALVALUE (249) |
| |
#define FIREWALLENABLED_MAGICALVALUE (250) |
| |
#define INBOUNDPINHOLEALLOWED_MAGICALVALUE (251) |
| |
#define SYSTEMUPDATEID_MAGICALVALUE (252) |
| |
#define PORTMAPPINGNUMBEROFENTRIES_MAGICALVALUE (253) |
| |
#define EXTERNALIPADDRESS_MAGICALVALUE (254) |
| |
#define DEFAULTCONNECTIONSERVICE_MAGICALVALUE (255) |
| |
|
| |
|
| static const char * const upnptypes[] = |
static const char * const upnptypes[] = |
| { |
{ |
| "string", |
"string", |
| "boolean", |
"boolean", |
| "ui2", |
"ui2", |
| "ui4" | "ui4", |
| | "bin.base64" |
| }; |
}; |
| |
|
| static const char * const upnpdefaultvalues[] = |
static const char * const upnpdefaultvalues[] = |
| { |
{ |
| 0, |
0, |
| "Unconfigured" | "IP_Routed"/*"Unconfigured"*/, /* 1 default value for ConnectionType */ |
| | "3600", /* 2 default value for PortMappingLeaseDuration */ |
| }; |
}; |
| |
|
| static const char * const upnpallowedvalues[] = |
static const char * const upnpallowedvalues[] = |
|
Line 61 static const char * const upnpallowedvalues[] =
|
Line 76 static const char * const upnpallowedvalues[] =
|
| "Disconnected", |
"Disconnected", |
| 0, |
0, |
| "ERROR_NONE", /* 25 */ |
"ERROR_NONE", /* 25 */ |
| |
/* Optionals values : |
| |
* ERROR_COMMAND_ABORTED |
| |
* ERROR_NOT_ENABLED_FOR_INTERNET |
| |
* ERROR_USER_DISCONNECT |
| |
* ERROR_ISP_DISCONNECT |
| |
* ERROR_IDLE_DISCONNECT |
| |
* ERROR_FORCED_DISCONNECT |
| |
* ERROR_NO_CARRIER |
| |
* ERROR_IP_CONFIGURATION |
| |
* ERROR_UNKNOWN */ |
| 0, |
0, |
| "", /* 27 */ |
"", /* 27 */ |
| 0 |
0 |
| }; |
}; |
| |
|
| |
static const int upnpallowedranges[] = { |
| |
0, |
| |
/* 1 PortMappingLeaseDuration */ |
| |
0, |
| |
604800, |
| |
/* 3 InternalPort */ |
| |
1, |
| |
65535, |
| |
/* 5 LeaseTime */ |
| |
1, |
| |
86400, |
| |
/* 7 OutboundPinholeTimeout */ |
| |
100, |
| |
200, |
| |
}; |
| |
|
| |
static const char * magicargname[] = { |
| |
0, |
| |
"StartPort", |
| |
"EndPort", |
| |
"RemoteHost", |
| |
"RemotePort", |
| |
"InternalClient", |
| |
"InternalPort", |
| |
"IsWorking" |
| |
}; |
| |
|
| static const char xmlver[] = |
static const char xmlver[] = |
| "<?xml version=\"1.0\"?>\r\n"; |
"<?xml version=\"1.0\"?>\r\n"; |
| static const char root_service[] = |
static const char root_service[] = |
|
Line 75 static const char root_device[] =
|
Line 127 static const char root_device[] =
|
| |
|
| /* root Description of the UPnP Device |
/* root Description of the UPnP Device |
| * fixed to match UPnP_IGD_InternetGatewayDevice 1.0.pdf |
* fixed to match UPnP_IGD_InternetGatewayDevice 1.0.pdf |
| |
* Needs to be checked with UPnP-gw-InternetGatewayDevice-v2-Device.pdf |
| * presentationURL is only "recommended" but the router doesn't appears |
* presentationURL is only "recommended" but the router doesn't appears |
| * in "Network connections" in Windows XP if it is not present. */ |
* in "Network connections" in Windows XP if it is not present. */ |
| static const struct XMLElt rootDesc[] = |
static const struct XMLElt rootDesc[] = |
|
Line 82 static const struct XMLElt rootDesc[] =
|
Line 135 static const struct XMLElt rootDesc[] =
|
| /* 0 */ |
/* 0 */ |
| {root_device, INITHELPER(1,2)}, |
{root_device, INITHELPER(1,2)}, |
| {"specVersion", INITHELPER(3,2)}, |
{"specVersion", INITHELPER(3,2)}, |
| #if defined(ENABLE_L3F_SERVICE) || defined(HAS_DUMMY_SERVICE) | #if defined(ENABLE_L3F_SERVICE) || defined(HAS_DUMMY_SERVICE) || defined(ENABLE_DP_SERVICE) |
| {"device", INITHELPER(5,13)}, |
{"device", INITHELPER(5,13)}, |
| #else |
#else |
| {"device", INITHELPER(5,12)}, |
{"device", INITHELPER(5,12)}, |
|
Line 90 static const struct XMLElt rootDesc[] =
|
Line 143 static const struct XMLElt rootDesc[] =
|
| {"/major", "1"}, |
{"/major", "1"}, |
| {"/minor", "0"}, |
{"/minor", "0"}, |
| /* 5 */ |
/* 5 */ |
| {"/deviceType", "urn:schemas-upnp-org:device:InternetGatewayDevice:1"}, | {"/deviceType", DEVICE_TYPE_IGD}, |
| | /* urn:schemas-upnp-org:device:InternetGatewayDevice:1 or 2 */ |
| {"/friendlyName", ROOTDEV_FRIENDLYNAME}, /* required */ |
{"/friendlyName", ROOTDEV_FRIENDLYNAME}, /* required */ |
| {"/manufacturer", ROOTDEV_MANUFACTURER}, /* required */ |
{"/manufacturer", ROOTDEV_MANUFACTURER}, /* required */ |
| /* 8 */ |
/* 8 */ |
|
Line 101 static const struct XMLElt rootDesc[] =
|
Line 155 static const struct XMLElt rootDesc[] =
|
| {"/modelURL", ROOTDEV_MODELURL}, |
{"/modelURL", ROOTDEV_MODELURL}, |
| {"/serialNumber", serialnumber}, |
{"/serialNumber", serialnumber}, |
| {"/UDN", uuidvalue}, /* required */ |
{"/UDN", uuidvalue}, /* required */ |
| #if defined(ENABLE_L3F_SERVICE) || defined(HAS_DUMMY_SERVICE) | /* see if /UPC is needed. */ |
| {"serviceList", INITHELPER(57,1)}, | #ifdef ENABLE_6FC_SERVICE |
| | #define SERVICES_OFFSET 63 |
| | #else |
| | #define SERVICES_OFFSET 58 |
| | #endif |
| | #if defined(ENABLE_L3F_SERVICE) || defined(HAS_DUMMY_SERVICE) || defined(ENABLE_DP_SERVICE) |
| | /* here we dening Services for the root device : |
| | * L3F and DUMMY and DeviceProtection */ |
| | #ifdef ENABLE_L3F_SERVICE |
| | #define NSERVICES1 1 |
| | #else |
| | #define NSERVICES1 0 |
| | #endif |
| | #ifdef HAS_DUMMY_SERVICE |
| | #define NSERVICES2 1 |
| | #else |
| | #define NSERVICES2 0 |
| | #endif |
| | #ifdef ENABLE_DP_SERVICE |
| | #define NSERVICES3 1 |
| | #else |
| | #define NSERVICES3 0 |
| | #endif |
| | #define NSERVICES (NSERVICES1+NSERVICES2+NSERVICES3) |
| | {"serviceList", INITHELPER(SERVICES_OFFSET,NSERVICES)}, |
| {"deviceList", INITHELPER(18,1)}, |
{"deviceList", INITHELPER(18,1)}, |
| {"/presentationURL", presentationurl}, /* recommended */ |
{"/presentationURL", presentationurl}, /* recommended */ |
| #else |
#else |
|
Line 113 static const struct XMLElt rootDesc[] =
|
Line 191 static const struct XMLElt rootDesc[] =
|
| /* 18 */ |
/* 18 */ |
| {"device", INITHELPER(19,13)}, |
{"device", INITHELPER(19,13)}, |
| /* 19 */ |
/* 19 */ |
| {"/deviceType", "urn:schemas-upnp-org:device:WANDevice:1"}, /* required */ | {"/deviceType", DEVICE_TYPE_WAN}, /* required */ |
| | /* urn:schemas-upnp-org:device:WANDevice:1 or 2 */ |
| {"/friendlyName", WANDEV_FRIENDLYNAME}, |
{"/friendlyName", WANDEV_FRIENDLYNAME}, |
| {"/manufacturer", WANDEV_MANUFACTURER}, |
{"/manufacturer", WANDEV_MANUFACTURER}, |
| {"/manufacturerURL", WANDEV_MANUFACTURERURL}, |
{"/manufacturerURL", WANDEV_MANUFACTURERURL}, |
|
Line 140 static const struct XMLElt rootDesc[] =
|
Line 219 static const struct XMLElt rootDesc[] =
|
| /* 38 */ |
/* 38 */ |
| {"device", INITHELPER(39,12)}, |
{"device", INITHELPER(39,12)}, |
| /* 39 */ |
/* 39 */ |
| {"/deviceType", "urn:schemas-upnp-org:device:WANConnectionDevice:1"}, | {"/deviceType", DEVICE_TYPE_WANC}, |
| | /* urn:schemas-upnp-org:device:WANConnectionDevice:1 or 2 */ |
| {"/friendlyName", WANCDEV_FRIENDLYNAME}, |
{"/friendlyName", WANCDEV_FRIENDLYNAME}, |
| {"/manufacturer", WANCDEV_MANUFACTURER}, |
{"/manufacturer", WANCDEV_MANUFACTURER}, |
| {"/manufacturerURL", WANCDEV_MANUFACTURERURL}, |
{"/manufacturerURL", WANCDEV_MANUFACTURERURL}, |
|
Line 151 static const struct XMLElt rootDesc[] =
|
Line 231 static const struct XMLElt rootDesc[] =
|
| {"/serialNumber", serialnumber}, |
{"/serialNumber", serialnumber}, |
| {"/UDN", uuidvalue}, |
{"/UDN", uuidvalue}, |
| {"/UPC", WANCDEV_UPC}, |
{"/UPC", WANCDEV_UPC}, |
| |
#ifdef ENABLE_6FC_SERVICE |
| |
{"serviceList", INITHELPER(51,2)}, |
| |
#else |
| {"serviceList", INITHELPER(51,1)}, |
{"serviceList", INITHELPER(51,1)}, |
| |
#endif |
| /* 51 */ |
/* 51 */ |
| {"service", INITHELPER(52,5)}, | {"service", INITHELPER(53,5)}, |
| /* 52 */ | {"service", INITHELPER(58,5)}, |
| {"/serviceType", "urn:schemas-upnp-org:service:WANIPConnection:1"}, | /* 53 */ |
| /* {"/serviceId", "urn:upnp-org:serviceId:WANIPConnection"}, */ | {"/serviceType", SERVICE_TYPE_WANIPC}, |
| {"/serviceId", "urn:upnp-org:serviceId:WANIPConn1"}, | /* urn:schemas-upnp-org:service:WANIPConnection:2 for v2 */ |
| | {"/serviceId", SERVICE_ID_WANIPC}, |
| | /* urn:upnp-org:serviceId:WANIPConn1 or 2 */ |
| {"/controlURL", WANIPC_CONTROLURL}, |
{"/controlURL", WANIPC_CONTROLURL}, |
| {"/eventSubURL", WANIPC_EVENTURL}, |
{"/eventSubURL", WANIPC_EVENTURL}, |
| {"/SCPDURL", WANIPC_PATH}, |
{"/SCPDURL", WANIPC_PATH}, |
| /* 57 */ | #ifdef ENABLE_6FC_SERVICE |
| #ifdef HAS_DUMMY_SERVICE | |
| {"service", INITHELPER(58,5)}, | |
| /* 58 */ |
/* 58 */ |
| |
{"/serviceType", "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"}, |
| |
{"/serviceId", "urn:upnp-org:serviceId:WANIPv6FC1"}, |
| |
{"/controlURL", WANIP6FC_CONTROLURL}, |
| |
{"/eventSubURL", WANIP6FC_EVENTURL}, |
| |
{"/SCPDURL", WANIP6FC_PATH}, |
| |
#endif |
| |
/* 58 / 63 = SERVICES_OFFSET*/ |
| |
#if defined(HAS_DUMMY_SERVICE) || defined(ENABLE_L3F_SERVICE) || defined(ENABLE_DP_SERVICE) |
| |
{"service", INITHELPER(SERVICES_OFFSET+2,5)}, |
| |
{"service", INITHELPER(SERVICES_OFFSET+7,5)}, |
| |
#endif |
| |
#ifdef HAS_DUMMY_SERVICE |
| |
/* 60 / 65 = SERVICES_OFFSET+2 */ |
| {"/serviceType", "urn:schemas-dummy-com:service:Dummy:1"}, |
{"/serviceType", "urn:schemas-dummy-com:service:Dummy:1"}, |
| {"/serviceId", "urn:dummy-com:serviceId:dummy1"}, |
{"/serviceId", "urn:dummy-com:serviceId:dummy1"}, |
| {"/controlURL", "/dummy"}, |
{"/controlURL", "/dummy"}, |
|
Line 172 static const struct XMLElt rootDesc[] =
|
Line 269 static const struct XMLElt rootDesc[] =
|
| {"/SCPDURL", DUMMY_PATH}, |
{"/SCPDURL", DUMMY_PATH}, |
| #endif |
#endif |
| #ifdef ENABLE_L3F_SERVICE |
#ifdef ENABLE_L3F_SERVICE |
| {"service", INITHELPER(58,5)}, | /* 60 / 65 = SERVICES_OFFSET+2 */ |
| /* 58 */ | |
| {"/serviceType", "urn:schemas-upnp-org:service:Layer3Forwarding:1"}, |
{"/serviceType", "urn:schemas-upnp-org:service:Layer3Forwarding:1"}, |
| {"/serviceId", "urn:upnp-org:serviceId:Layer3Forwarding1"}, |
{"/serviceId", "urn:upnp-org:serviceId:Layer3Forwarding1"}, |
| {"/controlURL", L3F_CONTROLURL}, /* The Layer3Forwarding service is only */ |
{"/controlURL", L3F_CONTROLURL}, /* The Layer3Forwarding service is only */ |
| {"/eventSubURL", L3F_EVENTURL}, /* recommended, not mandatory */ |
{"/eventSubURL", L3F_EVENTURL}, /* recommended, not mandatory */ |
| {"/SCPDURL", L3F_PATH}, |
{"/SCPDURL", L3F_PATH}, |
| #endif |
#endif |
| |
#ifdef ENABLE_DP_SERVICE |
| |
/* InternetGatewayDevice v2 : |
| |
* it is RECOMMEDED that DeviceProtection service is implemented and applied. |
| |
* If DeviceProtection is not implemented and applied, it is RECOMMENDED |
| |
* that control points are able to access only actions and parameters defined |
| |
* as Public role. */ |
| |
/* 65 / 70 = SERVICES_OFFSET+7 */ |
| |
{"/serviceType", "urn:schemas-upnp-org:service:DeviceProtection:1"}, |
| |
{"/serviceId", "urn:upnp-org:serviceId:DeviceProtection1"}, |
| |
{"/controlURL", DP_CONTROLURL}, |
| |
{"/eventSubURL", DP_EVENTURL}, |
| |
{"/SCPDURL", DP_PATH}, |
| |
#endif |
| {0, 0} |
{0, 0} |
| }; |
}; |
| |
|
|
Line 193 static struct XMLElt scpdWANIPCn[] =
|
Line 302 static struct XMLElt scpdWANIPCn[] =
|
| */ |
*/ |
| static const struct argument AddPortMappingArgs[] = |
static const struct argument AddPortMappingArgs[] = |
| { |
{ |
| {1, 11}, | {1, 11}, /* RemoteHost */ |
| {1, 12}, | {1, 12}, /* ExternalPort */ |
| {1, 14}, | {1, 14}, /* PortMappingProtocol */ |
| {1, 13}, | {1, 13}, /* InternalPort */ |
| {1, 15}, | {1, 15}, /* InternalClient */ |
| {1, 9}, | {1, 9}, /* PortMappingEnabled */ |
| {1, 16}, | {1, 16}, /* PortMappingDescription */ |
| {1, 10}, | {1, 10}, /* PortMappingLeaseDuration */ |
| {0, 0} |
{0, 0} |
| }; |
}; |
| |
|
| |
#ifdef IGD_V2 |
| |
static const struct argument AddAnyPortMappingArgs[] = |
| |
{ |
| |
{1, 11}, /* RemoteHost */ |
| |
{1, 12}, /* ExternalPort */ |
| |
{1, 14}, /* PortMappingProtocol */ |
| |
{1, 13}, /* InternalPort */ |
| |
{1, 15}, /* InternalClient */ |
| |
{1, 9}, /* PortMappingEnabled */ |
| |
{1, 16}, /* PortMappingDescription */ |
| |
{1, 10}, /* PortMappingLeaseDuration */ |
| |
{2, 12}, /* NewReservedPort / ExternalPort */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument DeletePortMappingRangeArgs[] = |
| |
{ |
| |
{1|(1<<2), 12}, /* NewStartPort / ExternalPort */ |
| |
{1|(2<<2), 12}, /* NewEndPort / ExternalPort */ |
| |
{1, 14}, /* NewProtocol / PortMappingProtocol */ |
| |
{1, 18}, /* NewManage / A_ARG_TYPE_Manage */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument GetListOfPortMappingsArgs[] = |
| |
{ |
| |
{1|(1<<2), 12}, /* NewStartPort / ExternalPort */ |
| |
{1|(2<<2), 12}, /* NewEndPort / ExternalPort */ |
| |
{1, 14}, /* NewProtocol / PortMappingProtocol */ |
| |
{1, 18}, /* NewManage / A_ARG_TYPE_Manage */ |
| |
{1, 8}, /* NewNumberOfPorts / PortMappingNumberOfEntries */ |
| |
{2, 19}, /* NewPortListing / A_ARG_TYPE_PortListing */ |
| |
{0, 0} |
| |
}; |
| |
#endif |
| |
|
| static const struct argument GetExternalIPAddressArgs[] = |
static const struct argument GetExternalIPAddressArgs[] = |
| { |
{ |
| {2, 7}, |
{2, 7}, |
|
Line 275 static const struct argument GetSpecificPortMappingEnt
|
Line 420 static const struct argument GetSpecificPortMappingEnt
|
| |
|
| static const struct action WANIPCnActions[] = |
static const struct action WANIPCnActions[] = |
| { |
{ |
| |
{"SetConnectionType", SetConnectionTypeArgs}, /* R */ |
| |
{"GetConnectionTypeInfo", GetConnectionTypeInfoArgs}, /* R */ |
| |
{"RequestConnection", 0}, /* R */ |
| |
{"RequestTermination", 0}, /* O */ |
| |
{"ForceTermination", 0}, /* R */ |
| |
/*{"SetAutoDisconnectTime", 0},*/ /* O */ |
| |
/*{"SetIdleDisconnectTime", 0},*/ /* O */ |
| |
/*{"SetWarnDisconnectDelay", 0}, */ /* O */ |
| |
{"GetStatusInfo", GetStatusInfoArgs}, /* R */ |
| |
/*GetAutoDisconnectTime*/ |
| |
/*GetIdleDisconnectTime*/ |
| |
/*GetWarnDisconnectDelay*/ |
| |
{"GetNATRSIPStatus", GetNATRSIPStatusArgs}, /* R */ |
| |
{"GetGenericPortMappingEntry", GetGenericPortMappingEntryArgs}, /* R */ |
| |
{"GetSpecificPortMappingEntry", GetSpecificPortMappingEntryArgs}, /* R */ |
| {"AddPortMapping", AddPortMappingArgs}, /* R */ |
{"AddPortMapping", AddPortMappingArgs}, /* R */ |
| |
{"DeletePortMapping", DeletePortMappingArgs}, /* R */ |
| {"GetExternalIPAddress", GetExternalIPAddressArgs}, /* R */ |
{"GetExternalIPAddress", GetExternalIPAddressArgs}, /* R */ |
| |
#ifdef IGD_V2 |
| |
{"DeletePortMappingRange", DeletePortMappingRangeArgs}, /* R, IGD v2 */ |
| |
{"GetListOfPortMappings", GetListOfPortMappingsArgs}, /* R, IGD v2 */ |
| |
{"AddAnyPortMapping", AddAnyPortMappingArgs}, /* R, IGD v2 */ |
| |
#endif |
| |
#if 0 |
| |
{"AddPortMapping", AddPortMappingArgs}, /* R */ |
| |
{"GetExternalIPAddress", GetExternalIPAddressArgs}, /* R */ |
| {"DeletePortMapping", DeletePortMappingArgs}, /* R */ |
{"DeletePortMapping", DeletePortMappingArgs}, /* R */ |
| {"SetConnectionType", SetConnectionTypeArgs}, /* R */ |
{"SetConnectionType", SetConnectionTypeArgs}, /* R */ |
| {"GetConnectionTypeInfo", GetConnectionTypeInfoArgs}, /* R */ |
{"GetConnectionTypeInfo", GetConnectionTypeInfoArgs}, /* R */ |
|
Line 286 static const struct action WANIPCnActions[] =
|
Line 455 static const struct action WANIPCnActions[] =
|
| {"GetNATRSIPStatus", GetNATRSIPStatusArgs}, /* R */ |
{"GetNATRSIPStatus", GetNATRSIPStatusArgs}, /* R */ |
| {"GetGenericPortMappingEntry", GetGenericPortMappingEntryArgs}, /* R */ |
{"GetGenericPortMappingEntry", GetGenericPortMappingEntryArgs}, /* R */ |
| {"GetSpecificPortMappingEntry", GetSpecificPortMappingEntryArgs}, /* R */ |
{"GetSpecificPortMappingEntry", GetSpecificPortMappingEntryArgs}, /* R */ |
| |
/* added in v2 UPnP-gw-WANIPConnection-v2-Service.pdf */ |
| |
#ifdef IGD_V2 |
| |
{"AddAnyPortMapping", AddAnyPortMappingArgs}, |
| |
{"DeletePortMappingRange", DeletePortMappingRangeArgs}, |
| |
{"GetListOfPortMappings", GetListOfPortMappingsArgs}, |
| |
#endif |
| |
#endif |
| {0, 0} |
{0, 0} |
| }; |
}; |
| /* R=Required, O=Optional */ |
/* R=Required, O=Optional */ |
|
Line 293 static const struct action WANIPCnActions[] =
|
Line 469 static const struct action WANIPCnActions[] =
|
| static const struct stateVar WANIPCnVars[] = |
static const struct stateVar WANIPCnVars[] = |
| { |
{ |
| /* 0 */ |
/* 0 */ |
| |
#if 0 |
| {"ConnectionType", 0, 0/*1*/}, /* required */ |
{"ConnectionType", 0, 0/*1*/}, /* required */ |
| {"PossibleConnectionTypes", 0|0x80, 0, 14, 15}, |
{"PossibleConnectionTypes", 0|0x80, 0, 14, 15}, |
| |
#endif |
| |
{"ConnectionType", 0, 1, 14, 15}, /* required */ |
| |
{"PossibleConnectionTypes", 0|0x80, 0, 0, 15}, |
| /* Required |
/* Required |
| * Allowed values : Unconfigured / IP_Routed / IP_Bridged */ |
* Allowed values : Unconfigured / IP_Routed / IP_Bridged */ |
| {"ConnectionStatus", 0|0x80, 0/*1*/, 18, 20}, /* required */ | {"ConnectionStatus", 0|0x80, 0/*1*/, 18, |
| | CONNECTIONSTATUS_MAGICALVALUE }, /* required */ |
| /* Allowed Values : Unconfigured / Connecting(opt) / Connected |
/* Allowed Values : Unconfigured / Connecting(opt) / Connected |
| * PendingDisconnect(opt) / Disconnecting (opt) |
* PendingDisconnect(opt) / Disconnecting (opt) |
| * Disconnected */ |
* Disconnected */ |
|
Line 314 static const struct stateVar WANIPCnVars[] =
|
Line 495 static const struct stateVar WANIPCnVars[] =
|
| * ERROR_UNKNOWN(opt) */ |
* ERROR_UNKNOWN(opt) */ |
| {"RSIPAvailable", 1, 0}, /* required */ |
{"RSIPAvailable", 1, 0}, /* required */ |
| {"NATEnabled", 1, 0}, /* required */ |
{"NATEnabled", 1, 0}, /* required */ |
| {"ExternalIPAddress", 0|0x80, 0, 0, 254}, /* required. Default : empty string */ | {"ExternalIPAddress", 0|0x80, 0, 0, |
| {"PortMappingNumberOfEntries", 2|0x80, 0, 0, 253}, /* required >= 0 */ | EXTERNALIPADDRESS_MAGICALVALUE}, /* required. Default : empty string */ |
| | {"PortMappingNumberOfEntries", 2|0x80, 0, 0, |
| | PORTMAPPINGNUMBEROFENTRIES_MAGICALVALUE}, /* required >= 0 */ |
| {"PortMappingEnabled", 1, 0}, /* Required */ |
{"PortMappingEnabled", 1, 0}, /* Required */ |
| {"PortMappingLeaseDuration", 3, 0}, /* required */ | /* 10 */ |
| | {"PortMappingLeaseDuration", 3, 2, 1}, /* required */ |
| | /* TODO : for IGD v2 : |
| | * <stateVariable sendEvents="no"> |
| | * <name>PortMappingLeaseDuration</name> |
| | * <dataType>ui4</dataType> |
| | * <defaultValue>Vendor-defined</defaultValue> |
| | * <allowedValueRange> |
| | * <minimum>0</minimum> |
| | * <maximum>604800</maximum> |
| | * </allowedValueRange> |
| | * </stateVariable> */ |
| {"RemoteHost", 0, 0}, /* required. Default : empty string */ |
{"RemoteHost", 0, 0}, /* required. Default : empty string */ |
| {"ExternalPort", 2, 0}, /* required */ |
{"ExternalPort", 2, 0}, /* required */ |
| {"InternalPort", 2, 0}, /* required */ | {"InternalPort", 2, 0, 3}, /* required */ |
| {"PortMappingProtocol", 0, 0, 11}, /* required allowedValues: TCP/UDP */ |
{"PortMappingProtocol", 0, 0, 11}, /* required allowedValues: TCP/UDP */ |
| {"InternalClient", 0, 0}, /* required */ |
{"InternalClient", 0, 0}, /* required */ |
| {"PortMappingDescription", 0, 0}, /* required default: empty string */ |
{"PortMappingDescription", 0, 0}, /* required default: empty string */ |
| |
/* added in v2 UPnP-gw-WANIPConnection-v2-Service.pdf */ |
| |
#ifdef IGD_V2 |
| |
{"SystemUpdateID", 3|0x80, 0, 0, SYSTEMUPDATEID_MAGICALVALUE}, |
| |
{"A_ARG_TYPE_Manage", 1, 0}, |
| |
{"A_ARG_TYPE_PortListing", 0, 0}, |
| |
#endif |
| {0, 0} |
{0, 0} |
| }; |
}; |
| |
|
|
Line 394 static const struct stateVar WANCfgVars[] =
|
Line 594 static const struct stateVar WANCfgVars[] =
|
| {"TotalPacketsSent", 3, 0}, /* Optional */ |
{"TotalPacketsSent", 3, 0}, /* Optional */ |
| {"TotalPacketsReceived", 3, 0},/* Optional */ |
{"TotalPacketsReceived", 3, 0},/* Optional */ |
| /*{"MaximumActiveConnections", 2, 0}, // allowed Range value // OPTIONAL */ |
/*{"MaximumActiveConnections", 2, 0}, // allowed Range value // OPTIONAL */ |
| |
/*{"WANAccessProvider", 0, 0},*/ /* Optional */ |
| {0, 0} |
{0, 0} |
| }; |
}; |
| |
|
|
Line 423 static const struct action L3FActions[] =
|
Line 624 static const struct action L3FActions[] =
|
| |
|
| static const struct stateVar L3FVars[] = |
static const struct stateVar L3FVars[] = |
| { |
{ |
| {"DefaultConnectionService", 0|0x80, 0, 0, 255}, /* Required */ | {"DefaultConnectionService", 0|0x80, 0, 0, |
| | DEFAULTCONNECTIONSERVICE_MAGICALVALUE}, /* Required */ |
| {0, 0} |
{0, 0} |
| }; |
}; |
| |
|
|
Line 431 static const struct serviceDesc scpdL3F =
|
Line 633 static const struct serviceDesc scpdL3F =
|
| { L3FActions, L3FVars }; |
{ L3FActions, L3FVars }; |
| #endif |
#endif |
| |
|
| |
#ifdef ENABLE_6FC_SERVICE |
| |
/* see UPnP-gw-WANIPv6FirewallControl-v1-Service.pdf */ |
| |
static const struct argument GetFirewallStatusArgs[] = |
| |
{ |
| |
{2|0x80, 0}, /* OUT : FirewallEnabled */ |
| |
{2|0x80, 6}, /* OUT : InboundPinholeAllowed */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument GetOutboundPinholeTimeoutArgs[] = |
| |
{ |
| |
{1|0x80|(3<<2), 1}, /* RemoteHost IN A_ARG_TYPE_IPv6Address */ |
| |
{1|0x80|(4<<2), 2}, /* RemotePort IN A_ARG_TYPE_Port */ |
| |
{1|0x80|(5<<2), 1}, /* InternalClient IN A_ARG_TYPE_IPv6Address */ |
| |
{1|0x80|(6<<2), 2}, /* InternalPort IN A_ARG_TYPE_Port */ |
| |
{1|0x80, 3}, /* Protocol IN A_ARG_TYPE_Protocol */ |
| |
{2|0x80, 7}, /* OutboundPinholeTimeout OUT A_ARG_TYPE_OutboundPinholeTimeout */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument AddPinholeArgs[] = |
| |
{ |
| |
{1|0x80|(3<<2), 1}, /* RemoteHost IN A_ARG_TYPE_IPv6Address */ |
| |
{1|0x80|(4<<2), 2}, /* RemotePort IN A_ARG_TYPE_Port */ |
| |
{1|0x80|(5<<2), 1}, /* InternalClient IN A_ARG_TYPE_IPv6Address */ |
| |
{1|0x80|(6<<2), 2}, /* InternalPort IN A_ARG_TYPE_Port */ |
| |
{1|0x80, 3}, /* Protocol IN A_ARG_TYPE_Protocol */ |
| |
{1|0x80, 5}, /* LeaseTime IN A_ARG_TYPE_LeaseTime */ |
| |
{2|0x80, 4}, /* UniqueID OUT A_ARG_TYPE_UniqueID */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument UpdatePinholeArgs[] = |
| |
{ |
| |
{1|0x80, 4}, /* UniqueID IN A_ARG_TYPE_UniqueID */ |
| |
{1, 5}, /* LeaseTime IN A_ARG_TYPE_LeaseTime */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument DeletePinholeArgs[] = |
| |
{ |
| |
{1|0x80, 4}, /* UniqueID IN A_ARG_TYPE_UniqueID */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument GetPinholePacketsArgs[] = |
| |
{ |
| |
{1|0x80, 4}, /* UniqueID IN A_ARG_TYPE_UniqueID */ |
| |
{2|0x80, 9}, /* PinholePackets OUT A_ARG_TYPE_PinholePackets */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct argument CheckPinholeWorkingArgs[] = |
| |
{ |
| |
{1|0x80, 4}, /* UniqueID IN A_ARG_TYPE_UniqueID */ |
| |
{2|0x80|(7<<2), 8}, /* IsWorking OUT A_ARG_TYPE_Boolean */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct action IPv6FCActions[] = |
| |
{ |
| |
{"GetFirewallStatus", GetFirewallStatusArgs}, /* Req */ |
| |
{"GetOutboundPinholeTimeout", GetOutboundPinholeTimeoutArgs}, /* Opt */ |
| |
{"AddPinhole", AddPinholeArgs}, /* Req */ |
| |
{"UpdatePinhole", UpdatePinholeArgs}, /* Req */ |
| |
{"DeletePinhole", DeletePinholeArgs}, /* Req */ |
| |
{"GetPinholePackets", GetPinholePacketsArgs}, /* Req */ |
| |
{"CheckPinholeWorking", CheckPinholeWorkingArgs}, /* Opt */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct stateVar IPv6FCVars[] = |
| |
{ |
| |
{"FirewallEnabled", 1|0x80, 0, 0, |
| |
FIREWALLENABLED_MAGICALVALUE}, /* Required */ |
| |
{"A_ARG_TYPE_IPv6Address", 0, 0, 0, 0}, /* Required */ |
| |
{"A_ARG_TYPE_Port", 2, 0, 0, 0}, /* Required */ |
| |
{"A_ARG_TYPE_Protocol", 2, 0, 0, 0}, /* Required */ |
| |
/* 4 */ |
| |
{"A_ARG_TYPE_UniqueID", 2, 0, 0, 0}, /* Required */ |
| |
{"A_ARG_TYPE_LeaseTime", 3, 0, 5, 0}, /* Required */ |
| |
{"InboundPinholeAllowed", 1|0x80, 0, 0, |
| |
INBOUNDPINHOLEALLOWED_MAGICALVALUE}, /* Required */ |
| |
{"A_ARG_TYPE_OutboundPinholeTimeout", 3, 0, 7, 0}, /* Optional */ |
| |
/* 8 */ |
| |
{"A_ARG_TYPE_Boolean", 1, 0, 0, 0}, /* Optional */ |
| |
{"A_ARG_TYPE_PinholePackets", 3, 0, 0, 0}, /* Required */ |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct serviceDesc scpd6FC = |
| |
{ IPv6FCActions, IPv6FCVars }; |
| |
#endif |
| |
|
| |
#ifdef ENABLE_DP_SERVICE |
| |
/* UPnP-gw-DeviceProtection-v1-Service.pdf */ |
| |
static const struct action DPActions[] = |
| |
{ |
| |
{"SendSetupMessage", 0}, |
| |
{"GetSupportedProtocols", 0}, |
| |
{"GetAssignedRoles", 0}, |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct stateVar DPVars[] = |
| |
{ |
| |
{"SetupReady", 1|0x80}, |
| |
{"SupportedProtocols", 0}, |
| |
{"A_ARG_TYPE_ACL", 0}, |
| |
{"A_ARG_TYPE_IdentityList", 0}, |
| |
{"A_ARG_TYPE_Identity", 0}, |
| |
{"A_ARG_TYPE_Base64", 4}, |
| |
{"A_ARG_TYPE_String", 0}, |
| |
{0, 0} |
| |
}; |
| |
|
| |
static const struct serviceDesc scpdDP = |
| |
{ DPActions, DPVars }; |
| |
#endif |
| |
|
| /* strcat_str() |
/* strcat_str() |
| * concatenate the string and use realloc to increase the |
* concatenate the string and use realloc to increase the |
| * memory buffer if needed. */ |
* memory buffer if needed. */ |
|
Line 438 static char *
|
Line 760 static char *
|
| strcat_str(char * str, int * len, int * tmplen, const char * s2) |
strcat_str(char * str, int * len, int * tmplen, const char * s2) |
| { |
{ |
| int s2len; |
int s2len; |
| |
int newlen; |
| |
char * p; |
| |
|
| s2len = (int)strlen(s2); |
s2len = (int)strlen(s2); |
| if(*tmplen <= (*len + s2len)) |
if(*tmplen <= (*len + s2len)) |
| { |
{ |
| if(s2len < 256) |
if(s2len < 256) |
| *tmplen += 256; | newlen = *tmplen + 256; |
| else |
else |
| *tmplen += s2len + 1; | newlen = *tmplen + s2len + 1; |
| str = (char *)realloc(str, *tmplen); | p = (char *)realloc(str, newlen); |
| | if(p == NULL) /* handle a failure of realloc() */ |
| | return str; |
| | str = p; |
| | *tmplen = newlen; |
| } |
} |
| /*strcpy(str + *len, s2); */ |
/*strcpy(str + *len, s2); */ |
| memcpy(str + *len, s2, s2len + 1); |
memcpy(str + *len, s2, s2len + 1); |
|
Line 459 strcat_str(char * str, int * len, int * tmplen, const
|
Line 788 strcat_str(char * str, int * len, int * tmplen, const
|
| static char * |
static char * |
| strcat_char(char * str, int * len, int * tmplen, char c) |
strcat_char(char * str, int * len, int * tmplen, char c) |
| { |
{ |
| |
char * p; |
| |
|
| if(*tmplen <= (*len + 1)) |
if(*tmplen <= (*len + 1)) |
| { |
{ |
| *tmplen += 256; |
*tmplen += 256; |
| str = (char *)realloc(str, *tmplen); | p = (char *)realloc(str, *tmplen); |
| | if(p == NULL) /* handle a failure of realloc() */ |
| | { |
| | *tmplen -= 256; |
| | return str; |
| | } |
| | str = p; |
| } |
} |
| str[*len] = c; |
str[*len] = c; |
| (*len)++; |
(*len)++; |
| return str; |
return str; |
| } |
} |
| |
|
| |
/* strcat_int() |
| |
* concatenate the string representation of the integer. |
| |
* call strcat_char() */ |
| |
static char * |
| |
strcat_int(char * str, int * len, int * tmplen, int i) |
| |
{ |
| |
char buf[16]; |
| |
int j; |
| |
|
| |
if(i < 0) { |
| |
str = strcat_char(str, len, tmplen, '-'); |
| |
i = -i; |
| |
} else if(i == 0) { |
| |
/* special case for 0 */ |
| |
str = strcat_char(str, len, tmplen, '0'); |
| |
return str; |
| |
} |
| |
j = 0; |
| |
while(i && j < sizeof(buf)) { |
| |
buf[j++] = '0' + (i % 10); |
| |
i = i / 10; |
| |
} |
| |
while(j > 0) { |
| |
str = strcat_char(str, len, tmplen, buf[--j]); |
| |
} |
| |
return str; |
| |
} |
| |
|
| /* iterative subroutine using a small stack |
/* iterative subroutine using a small stack |
| * This way, the progam stack usage is kept low */ |
* This way, the progam stack usage is kept low */ |
| static char * |
static char * |
|
Line 614 genServiceDesc(int * len, const struct serviceDesc * s
|
Line 979 genServiceDesc(int * len, const struct serviceDesc * s
|
| j = 0; |
j = 0; |
| while(args[j].dir) |
while(args[j].dir) |
| { |
{ |
| str = strcat_str(str, len, &tmplen, "<argument><name>New"); | str = strcat_str(str, len, &tmplen, "<argument><name>"); |
| | if((args[j].dir & 0x80) == 0) { |
| | str = strcat_str(str, len, &tmplen, "New"); |
| | } |
| p = vars[args[j].relatedVar].name; |
p = vars[args[j].relatedVar].name; |
| if(0 == memcmp(p, "PortMapping", 11) | if(args[j].dir & 0x7c) { |
| | /* use magic values ... */ |
| | str = strcat_str(str, len, &tmplen, magicargname[(args[j].dir & 0x7c) >> 2]); |
| | } else if(0 == memcmp(p, "PortMapping", 11) |
| && 0 != memcmp(p + 11, "Description", 11)) { |
&& 0 != memcmp(p + 11, "Description", 11)) { |
| if(0 == memcmp(p + 11, "NumberOfEntries", 15)) | if(0 == memcmp(p + 11, "NumberOfEntries", 15)) { |
| | /* PortMappingNumberOfEntries */ |
| | #ifdef IGD_V2 |
| | if(0 == memcmp(acts[i].name, "GetListOfPortMappings", 22)) { |
| | str = strcat_str(str, len, &tmplen, "NumberOfPorts"); |
| | } else { |
| | str = strcat_str(str, len, &tmplen, "PortMappingIndex"); |
| | } |
| | #else |
| str = strcat_str(str, len, &tmplen, "PortMappingIndex"); |
str = strcat_str(str, len, &tmplen, "PortMappingIndex"); |
| else | #endif |
| | } else { |
| | /* PortMappingEnabled |
| | * PortMappingLeaseDuration |
| | * PortMappingProtocol */ |
| str = strcat_str(str, len, &tmplen, p + 11); |
str = strcat_str(str, len, &tmplen, p + 11); |
| |
} |
| |
#ifdef IGD_V2 |
| |
} else if(0 == memcmp(p, "A_ARG_TYPE_", 11)) { |
| |
str = strcat_str(str, len, &tmplen, p + 11); |
| |
} else if(0 == memcmp(p, "ExternalPort", 13) |
| |
&& args[j].dir == 2 |
| |
&& 0 == memcmp(acts[i].name, "AddAnyPortMapping", 18)) { |
| |
str = strcat_str(str, len, &tmplen, "ReservedPort"); |
| |
#endif |
| } else { |
} else { |
| str = strcat_str(str, len, &tmplen, p); |
str = strcat_str(str, len, &tmplen, p); |
| } |
} |
| str = strcat_str(str, len, &tmplen, "</name><direction>"); |
str = strcat_str(str, len, &tmplen, "</name><direction>"); |
| str = strcat_str(str, len, &tmplen, args[j].dir==1?"in":"out"); | str = strcat_str(str, len, &tmplen, (args[j].dir&0x03)==1?"in":"out"); |
| str = strcat_str(str, len, &tmplen, |
str = strcat_str(str, len, &tmplen, |
| "</direction><relatedStateVariable>"); |
"</direction><relatedStateVariable>"); |
| str = strcat_str(str, len, &tmplen, p); |
str = strcat_str(str, len, &tmplen, p); |
|
Line 649 genServiceDesc(int * len, const struct serviceDesc * s
|
Line 1041 genServiceDesc(int * len, const struct serviceDesc * s
|
| #ifdef ENABLE_EVENTS |
#ifdef ENABLE_EVENTS |
| str = strcat_str(str, len, &tmplen, (vars[i].itype & 0x80)?"yes":"no"); |
str = strcat_str(str, len, &tmplen, (vars[i].itype & 0x80)?"yes":"no"); |
| #else |
#else |
| /* for the moment allways send no. Wait for SUBSCRIBE implementation | /* for the moment always send no. Wait for SUBSCRIBE implementation |
| * before setting it to yes */ |
* before setting it to yes */ |
| str = strcat_str(str, len, &tmplen, "no"); |
str = strcat_str(str, len, &tmplen, "no"); |
| #endif |
#endif |
|
Line 660 genServiceDesc(int * len, const struct serviceDesc * s
|
Line 1052 genServiceDesc(int * len, const struct serviceDesc * s
|
| str = strcat_str(str, len, &tmplen, "</dataType>"); |
str = strcat_str(str, len, &tmplen, "</dataType>"); |
| if(vars[i].iallowedlist) |
if(vars[i].iallowedlist) |
| { |
{ |
| str = strcat_str(str, len, &tmplen, "<allowedValueList>"); | if((vars[i].itype & 0x0f) == 0) |
| for(j=vars[i].iallowedlist; upnpallowedvalues[j]; j++) | |
| { |
{ |
| str = strcat_str(str, len, &tmplen, "<allowedValue>"); | /* string */ |
| str = strcat_str(str, len, &tmplen, upnpallowedvalues[j]); | str = strcat_str(str, len, &tmplen, "<allowedValueList>"); |
| str = strcat_str(str, len, &tmplen, "</allowedValue>"); | for(j=vars[i].iallowedlist; upnpallowedvalues[j]; j++) |
| | { |
| | str = strcat_str(str, len, &tmplen, "<allowedValue>"); |
| | str = strcat_str(str, len, &tmplen, upnpallowedvalues[j]); |
| | str = strcat_str(str, len, &tmplen, "</allowedValue>"); |
| | } |
| | str = strcat_str(str, len, &tmplen, "</allowedValueList>"); |
| | } else { |
| | /* ui2 and ui4 */ |
| | str = strcat_str(str, len, &tmplen, "<allowedValueRange><minimum>"); |
| | str = strcat_int(str, len, &tmplen, upnpallowedranges[vars[i].iallowedlist]); |
| | str = strcat_str(str, len, &tmplen, "</minimum><maximum>"); |
| | str = strcat_int(str, len, &tmplen, upnpallowedranges[vars[i].iallowedlist+1]); |
| | str = strcat_str(str, len, &tmplen, "</maximum></allowedValueRange>"); |
| } |
} |
| str = strcat_str(str, len, &tmplen, "</allowedValueList>"); |
|
| } |
} |
| /*if(vars[i].defaultValue) */ |
/*if(vars[i].defaultValue) */ |
| if(vars[i].idefault) |
if(vars[i].idefault) |
|
Line 710 genL3F(int * len)
|
Line 1113 genL3F(int * len)
|
| } |
} |
| #endif |
#endif |
| |
|
| |
#ifdef ENABLE_6FC_SERVICE |
| |
char * |
| |
gen6FC(int * len) |
| |
{ |
| |
return genServiceDesc(len, &scpd6FC); |
| |
} |
| |
#endif |
| |
|
| |
#ifdef ENABLE_DP_SERVICE |
| |
char * |
| |
genDP(int * len) |
| |
{ |
| |
return genServiceDesc(len, &scpdDP); |
| |
} |
| |
#endif |
| |
|
| #ifdef ENABLE_EVENTS |
#ifdef ENABLE_EVENTS |
| static char * |
static char * |
| genEventVars(int * len, const struct serviceDesc * s, const char * servns) |
genEventVars(int * len, const struct serviceDesc * s, const char * servns) |
|
Line 736 genEventVars(int * len, const struct serviceDesc * s,
|
Line 1155 genEventVars(int * len, const struct serviceDesc * s,
|
| switch(v->ieventvalue) { |
switch(v->ieventvalue) { |
| case 0: |
case 0: |
| break; |
break; |
| case 253: /* Port mapping number of entries magical value */ | case CONNECTIONSTATUS_MAGICALVALUE: |
| snprintf(tmp, sizeof(tmp), "%d", upnp_get_portmapping_number_of_entries()); | /* or get_wan_connection_status_str(ext_if_name) */ |
| | str = strcat_str(str, len, &tmplen, |
| | upnpallowedvalues[18 + get_wan_connection_status(ext_if_name)]); |
| | break; |
| | #ifdef ENABLE_6FC_SERVICE |
| | case FIREWALLENABLED_MAGICALVALUE: |
| | /* see 2.4.2 of UPnP-gw-WANIPv6FirewallControl-v1-Service.pdf */ |
| | snprintf(tmp, sizeof(tmp), "%d", |
| | ipv6fc_firewall_enabled); |
| str = strcat_str(str, len, &tmplen, tmp); |
str = strcat_str(str, len, &tmplen, tmp); |
| break; |
break; |
| case 254: /* External ip address magical value */ | case INBOUNDPINHOLEALLOWED_MAGICALVALUE: |
| | /* see 2.4.3 of UPnP-gw-WANIPv6FirewallControl-v1-Service.pdf */ |
| | snprintf(tmp, sizeof(tmp), "%d", |
| | ipv6fc_inbound_pinhole_allowed); |
| | str = strcat_str(str, len, &tmplen, tmp); |
| | break; |
| | #endif |
| | #ifdef IGD_V2 |
| | case SYSTEMUPDATEID_MAGICALVALUE: |
| | /* Please read section 2.3.23 SystemUpdateID |
| | * of UPnP-gw-WANIPConnection-v2-Service.pdf */ |
| | snprintf(tmp, sizeof(tmp), "%d", |
| | 1/* system update id */); |
| | str = strcat_str(str, len, &tmplen, tmp); |
| | break; |
| | #endif |
| | case PORTMAPPINGNUMBEROFENTRIES_MAGICALVALUE: |
| | /* Port mapping number of entries magical value */ |
| | snprintf(tmp, sizeof(tmp), "%d", |
| | upnp_get_portmapping_number_of_entries()); |
| | str = strcat_str(str, len, &tmplen, tmp); |
| | break; |
| | case EXTERNALIPADDRESS_MAGICALVALUE: |
| | /* External ip address magical value */ |
| if(use_ext_ip_addr) |
if(use_ext_ip_addr) |
| str = strcat_str(str, len, &tmplen, use_ext_ip_addr); |
str = strcat_str(str, len, &tmplen, use_ext_ip_addr); |
| else { |
else { |
|
Line 751 genEventVars(int * len, const struct serviceDesc * s,
|
Line 1201 genEventVars(int * len, const struct serviceDesc * s,
|
| str = strcat_str(str, len, &tmplen, ext_ip_addr); |
str = strcat_str(str, len, &tmplen, ext_ip_addr); |
| } |
} |
| } |
} |
| /*str = strcat_str(str, len, &tmplen, "0.0.0.0");*/ |
|
| break; |
break; |
| case 255: /* DefaultConnectionService magical value */ | case DEFAULTCONNECTIONSERVICE_MAGICALVALUE: |
| | /* DefaultConnectionService magical value */ |
| str = strcat_str(str, len, &tmplen, uuidvalue); |
str = strcat_str(str, len, &tmplen, uuidvalue); |
| str = strcat_str(str, len, &tmplen, ":WANConnectionDevice:1,urn:upnp-org:serviceId:WANIPConn1"); |
str = strcat_str(str, len, &tmplen, ":WANConnectionDevice:1,urn:upnp-org:serviceId:WANIPConn1"); |
| //printf("%s:WANConnectionDevice:1,urn:upnp-org:serviceId:WANIPConn1", uuidvalue); |
|
| break; |
break; |
| default: |
default: |
| str = strcat_str(str, len, &tmplen, upnpallowedvalues[v->ieventvalue]); |
str = strcat_str(str, len, &tmplen, upnpallowedvalues[v->ieventvalue]); |
| //printf("%s", upnpallowedvalues[v->ieventvalue]); |
|
| } |
} |
| str = strcat_str(str, len, &tmplen, "</s:"); |
str = strcat_str(str, len, &tmplen, "</s:"); |
| str = strcat_str(str, len, &tmplen, v->name); |
str = strcat_str(str, len, &tmplen, v->name); |
|
Line 782 getVarsWANIPCn(int * l)
|
Line 1230 getVarsWANIPCn(int * l)
|
| { |
{ |
| return genEventVars(l, |
return genEventVars(l, |
| &scpdWANIPCn, |
&scpdWANIPCn, |
| "urn:schemas-upnp-org:service:WANIPConnection:1"); | SERVICE_TYPE_WANIPC); |
| } |
} |
| |
|
| char * |
char * |
|
Line 802 getVarsL3F(int * l)
|
Line 1250 getVarsL3F(int * l)
|
| "urn:schemas-upnp-org:service:Layer3Forwarding:1"); |
"urn:schemas-upnp-org:service:Layer3Forwarding:1"); |
| } |
} |
| #endif |
#endif |
| |
|
| |
#ifdef ENABLE_6FC_SERVICE |
| |
char * |
| |
getVars6FC(int * l) |
| |
{ |
| |
return genEventVars(l, |
| |
&scpd6FC, |
| |
"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"); |
| |
} |
| #endif |
#endif |
| |
|
| |
#ifdef ENABLE_DP_SERVICE |
| |
char * |
| |
getVarsDP(int * l) |
| |
{ |
| |
return genEventVars(l, |
| |
&scpdDP, |
| |
"urn:schemas-upnp-org:service:DeviceProtection:1"); |
| |
} |
| |
#endif |
| |
|
| |
#endif /* ENABLE_EVENTS */ |