1/* 2 Copyright 2004, Broadcom Corporation 3 All Rights Reserved. 4 5 THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY 6 KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM 7 SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS 8 FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. 9 10 This file was automatically generated by xml2c.pl 11*/ 12 13 14#include "upnp_dbg.h" 15#include "upnp_osl.h" 16#include "upnp.h" 17#include "wanppp.h" 18 19/* 20 21 Below you will find definitions for a number of Action structures. 22 The second argument to those structures is a pointer to a function 23 that implements that action. Your job is to define all of the 24 actions so that none of them is left unimplemented. 25 26 As a convenience, all generated actions have been predefined to 27 invoke the action 'NotImplemented', an action that will print an 28 error message whenever it is invoked. As you define functions for 29 each action, be sure to remove that function name from the list of 30 'NotImplemented' defines in the list below. 31 32 The following are pre-defined action functions that you can use: 33 34 NotImplemented - prints an error message on the console 35 and returns 0 parameters to the caller. 36 37 DefaultAction - Returns all 'out' parameters with values 38 taken from the corresponding 'relatedStateVariable'. 39 This function actually covers the behavior of 40 a surprisingly large number of UPnP actions. 41 42*/ 43 44extern int WANPPPConnection_ConfigureConnection(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs); 45extern int WANPPPConnection_SetIdleDisconnectTime(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs); 46extern int WANPPPConnection_RequestConnection(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs); 47extern int WANPPPConnection_ForceTermination(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs); 48extern int WANPPPConnection_SetConnectionType(UFILE *uclient, PService psvc, PAction ac, pvar_entry_t args, int nargs); 49extern int GetGenericPortMappingEntry(UFILE *, PService , PAction, pvar_entry_t , int ); 50extern int GetSpecificPortMappingEntry(UFILE *, PService , PAction, pvar_entry_t , int); 51extern int AddPortMapping(UFILE *, PService, PAction, pvar_entry_t, int); 52extern int DeletePortMapping(UFILE *, PService, PAction, pvar_entry_t, int); 53 54#define GetConnectionTypeInfo DefaultAction 55#define GetLinkLayerMaxBitRates DefaultAction 56#define GetNATRSIPStatus DefaultAction 57#define GetUserName DefaultAction 58#define GetPassword DefaultAction 59#define GetStatusInfo DefaultAction 60#define GetIdleDisconnectTime DefaultAction 61#define GetExternalIPAddress DefaultAction 62 63/* VAR_ offsets are include from wanppp.h */ 64 65 66char *WANPPPConnection_PossibleConnectionTypes_allowedValueList[] = { "Unconfigured", "IP_Routed", "DHCP_Spoofed", "PPPOE_Bridged", "PPTP_Relay", "L2TP_Relay", "PPOE_Relay", NULL }; 67static char *ConnectionStatus_allowedValueList[] = { "Unconfigured", "Connecting", "Authenticating", "Connected", "PendingDisconnect", "Disconnecting", "Disconnected", NULL }; 68static char *LastConnectionError_allowedValueList[] = { "ERROR_NONE", "ERROR_UNKNOWN", NULL }; 69static char *PortMappingProtocol_allowedValueList[] = { "TCP", "UDP", NULL }; 70 71 72static VarTemplate StateVariables[] = { 73 { "ConnectionType", "IP_Routed", VAR_STRING|VAR_LIST, (allowedValue) { WANPPPConnection_PossibleConnectionTypes_allowedValueList } }, 74 { "PossibleConnectionTypes", "", VAR_EVENTED|VAR_STRING|VAR_LIST, (allowedValue) { WANPPPConnection_PossibleConnectionTypes_allowedValueList } }, 75 { "ConnectionStatus", "Unconfigured", VAR_EVENTED|VAR_STRING|VAR_LIST, (allowedValue) { ConnectionStatus_allowedValueList } }, 76 { "Uptime", "", VAR_ULONG }, 77 { "UpstreamMaxBitRate", "10000000", VAR_ULONG }, 78 { "DownstreamMaxBitRate", "10000000", VAR_ULONG }, 79 { "LastConnectionError", "", VAR_STRING|VAR_LIST, (allowedValue) { LastConnectionError_allowedValueList } }, 80 { "IdleDisconnectTime", "", VAR_ULONG }, 81 { "RSIPAvailable", "0", VAR_BOOL }, 82 { "NATEnabled", "0", VAR_BOOL }, 83 { "UserName", "", VAR_STRING }, 84 { "Password", "", VAR_STRING }, 85 { "ExternalIPAddress", "", VAR_EVENTED|VAR_STRING }, 86 { "PortMappingNumberOfEntries", "", VAR_EVENTED|VAR_USHORT }, 87 { "PortMappingEnabled", "", VAR_BOOL }, 88 { "PortMappingLeaseDuration", "", VAR_ULONG }, 89 { "RemoteHost", "", VAR_STRING }, 90 { "ExternalPort", "", VAR_USHORT }, 91 { "InternalPort", "", VAR_USHORT }, 92 { "PortMappingProtocol", "", VAR_STRING|VAR_LIST, (allowedValue) { PortMappingProtocol_allowedValueList } }, 93 { "InternalClient", "", VAR_STRING }, 94 { "PortMappingDescription", "", VAR_STRING }, 95 96 { NULL } 97}; 98 99 100static Action _SetConnectionType = { 101 "SetConnectionType", WANPPPConnection_SetConnectionType, 102 (Param []) { 103 {"NewConnectionType", VAR_ConnectionType, VAR_IN}, 104 { 0 } 105 } 106}; 107 108static Action _GetConnectionTypeInfo = { 109 "GetConnectionTypeInfo", GetConnectionTypeInfo, 110 (Param []) { 111 {"NewConnectionType", VAR_ConnectionType, VAR_OUT}, 112 {"NewPossibleConnectionTypes", VAR_PossibleConnectionTypes, VAR_OUT}, 113 { 0 } 114 } 115}; 116 117static Action _ConfigureConnection = { 118 "ConfigureConnection", WANPPPConnection_ConfigureConnection, 119 (Param []) { 120 {"NewUserName", VAR_UserName, VAR_IN}, 121 {"NewPassword", VAR_Password, VAR_IN}, 122 { 0 } 123 } 124}; 125 126static Action _RequestConnection = { 127 "RequestConnection", WANPPPConnection_RequestConnection, 128 (Param []) { 129 { 0 } 130 } 131}; 132 133static Action _ForceTermination = { 134 "ForceTermination", WANPPPConnection_ForceTermination, 135 (Param []) { 136 { 0 } 137 } 138}; 139 140static Action _SetIdleDisconnectTime = { 141 "SetIdleDisconnectTime", WANPPPConnection_SetIdleDisconnectTime, 142 (Param []) { 143 {"NewIdleDisconnectTime", VAR_IdleDisconnectTime, VAR_IN}, 144 { 0 } 145 } 146}; 147 148static Action _GetStatusInfo = { 149 "GetStatusInfo", GetStatusInfo, 150 (Param []) { 151 {"NewConnectionStatus", VAR_ConnectionStatus, VAR_OUT}, 152 {"NewLastConnectionError", VAR_LastConnectionError, VAR_OUT}, 153 {"NewUptime", VAR_Uptime, VAR_OUT}, 154 { 0 } 155 } 156}; 157 158static Action _GetLinkLayerMaxBitRates = { 159 "GetLinkLayerMaxBitRates", GetLinkLayerMaxBitRates, 160 (Param []) { 161 {"NewUpstreamMaxBitRate", VAR_UpstreamMaxBitRate, VAR_OUT}, 162 {"NewDownstreamMaxBitRate", VAR_DownstreamMaxBitRate, VAR_OUT}, 163 { 0 } 164 } 165}; 166 167static Action _GetUserName = { 168 "GetUserName", GetUserName, 169 (Param []) { 170 {"NewUserName", VAR_UserName, VAR_OUT}, 171 { 0 } 172 } 173}; 174 175static Action _GetPassword = { 176 "GetPassword", GetPassword, 177 (Param []) { 178 {"NewPassword", VAR_Password, VAR_OUT}, 179 { 0 } 180 } 181}; 182 183static Action _GetIdleDisconnectTime = { 184 "GetIdleDisconnectTime", GetIdleDisconnectTime, 185 (Param []) { 186 {"NewIdleDisconnectTime", VAR_IdleDisconnectTime, VAR_OUT}, 187 { 0 } 188 } 189}; 190 191static Action _GetNATRSIPStatus = { 192 "GetNATRSIPStatus", GetNATRSIPStatus, 193 (Param []) { 194 {"NewRSIPAvailable", VAR_RSIPAvailable, VAR_OUT}, 195 {"NewNATEnabled", VAR_NATEnabled, VAR_OUT}, 196 { 0 } 197 } 198}; 199 200static Action _GetGenericPortMappingEntry = { 201 "GetGenericPortMappingEntry", GetGenericPortMappingEntry, 202 (Param []) { 203 {"NewPortMappingIndex", VAR_PortMappingNumberOfEntries, VAR_IN}, 204 {"NewRemoteHost", VAR_RemoteHost, VAR_OUT}, 205 {"NewExternalPort", VAR_ExternalPort, VAR_OUT}, 206 {"NewProtocol", VAR_PortMappingProtocol, VAR_OUT}, 207 {"NewInternalPort", VAR_InternalPort, VAR_OUT}, 208 {"NewInternalClient", VAR_InternalClient, VAR_OUT}, 209 {"NewEnabled", VAR_PortMappingEnabled, VAR_OUT}, 210 {"NewPortMappingDescription", VAR_PortMappingDescription, VAR_OUT}, 211 {"NewLeaseDuration", VAR_PortMappingLeaseDuration, VAR_OUT}, 212 { 0 } 213 } 214}; 215 216static Action _GetSpecificPortMappingEntry = { 217 "GetSpecificPortMappingEntry", GetSpecificPortMappingEntry, 218 (Param []) { 219 {"NewRemoteHost", VAR_RemoteHost, VAR_IN}, 220 {"NewExternalPort", VAR_ExternalPort, VAR_IN}, 221 {"NewProtocol", VAR_PortMappingProtocol, VAR_IN}, 222 {"NewInternalPort", VAR_InternalPort, VAR_OUT}, 223 {"NewInternalClient", VAR_InternalClient, VAR_OUT}, 224 {"NewEnabled", VAR_PortMappingEnabled, VAR_OUT}, 225 {"NewPortMappingDescription", VAR_PortMappingDescription, VAR_OUT}, 226 {"NewLeaseDuration", VAR_PortMappingLeaseDuration, VAR_OUT}, 227 { 0 } 228 } 229}; 230 231static Action _AddPortMapping = { 232 "AddPortMapping", AddPortMapping, 233 (Param []) { 234 {"NewRemoteHost", VAR_RemoteHost, VAR_IN}, 235 {"NewExternalPort", VAR_ExternalPort, VAR_IN}, 236 {"NewProtocol", VAR_PortMappingProtocol, VAR_IN}, 237 {"NewInternalPort", VAR_InternalPort, VAR_IN}, 238 {"NewInternalClient", VAR_InternalClient, VAR_IN}, 239 {"NewEnabled", VAR_PortMappingEnabled, VAR_IN}, 240 {"NewPortMappingDescription", VAR_PortMappingDescription, VAR_IN}, 241 {"NewLeaseDuration", VAR_PortMappingLeaseDuration, VAR_IN}, 242 { 0 } 243 } 244}; 245 246static Action _DeletePortMapping = { 247 "DeletePortMapping", DeletePortMapping, 248 (Param []) { 249 {"NewRemoteHost", VAR_RemoteHost, VAR_IN}, 250 {"NewExternalPort", VAR_ExternalPort, VAR_IN}, 251 {"NewProtocol", VAR_PortMappingProtocol, VAR_IN}, 252 { 0 } 253 } 254}; 255 256static Action _GetExternalIPAddress = { 257 "GetExternalIPAddress", GetExternalIPAddress, 258 (Param []) { 259 {"NewExternalIPAddress", VAR_ExternalIPAddress, VAR_OUT}, 260 { 0 } 261 } 262}; 263 264 265 266static PAction Actions[] = { 267 &_SetConnectionType, 268 &_GetConnectionTypeInfo, 269 &_ConfigureConnection, 270 &_RequestConnection, 271 &_ForceTermination, 272 &_SetIdleDisconnectTime, 273 &_GetStatusInfo, 274 &_GetLinkLayerMaxBitRates, 275 &_GetUserName, 276 &_GetPassword, 277 &_GetIdleDisconnectTime, 278 &_GetNATRSIPStatus, 279 &_GetGenericPortMappingEntry, 280 &_GetSpecificPortMappingEntry, 281 &_AddPortMapping, 282 &_DeletePortMapping, 283 &_GetExternalIPAddress, 284 NULL 285}; 286 287ServiceTemplate Template_WANPPPConnection = { 288 "WANPPPConnection:1", /* name of service */ 289 NULL, /* PFSVCINIT service initialization function */ 290 WANPPPConnection_GetVar, /* PFGETVAR get service state variable function */ 291 NULL, /* SVCXML service XML generation function (not used) */ 292 ARRAYSIZE(StateVariables)-1, /* number of state variables */ 293 StateVariables, /* pointer to list of state variables */ 294 Actions, /* pointer to list of actions */ 295 0, /* count */ 296 "urn:upnp-org:serviceId:WANPPPConn", /* service id */ 297 NULL /* schema */ 298}; 299