2 * Copyright 2005, Broadcom Corporation
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.
10 * $Id: wanppp.c,v 1.1.1.7 2005/03/07 07:31:12 kanki Exp $
16 * This code doesn't do anything useful.
17 * Removed. Using just WANIPConnection instead.
34 extern void pppoe_up();
35 extern void pppoe_down();
39 extern void igd_restart(int secs
);
40 extern char * safe_snprintf(char *str
, int *len
, const char *fmt
, ...);
42 extern char *WANPPPConnection_PossibleConnectionTypes_allowedValueList
[];
44 int WANPPPConnection_GetVar(struct Service
*psvc
, int varindex
)
50 var
= &(psvc
->vars
[varindex
]);
53 case VAR_PossibleConnectionTypes
:
55 len
= sizeof(var
->value
);
56 for (p
= WANPPPConnection_PossibleConnectionTypes_allowedValueList
; *p
; p
++) {
57 if (cur
!= var
->value
)
58 cur
= safe_snprintf(cur
, &len
, ",");
59 cur
= safe_snprintf(cur
, &len
, "%s", *p
);
63 strcpy(var
->value
, nvram_safe_get("pppoe_username"));
66 strcpy(var
->value
, nvram_safe_get("pppoe_passwd"));
68 case VAR_IdleDisconnectTime
:
69 strcpy(var
->value
, nvram_safe_get("pppoe_idletime"));
71 case VAR_ExternalIPAddress
:
72 strcpy(var
->value
, nvram_safe_get("wan_ipaddr"));
79 int WANPPPConnection_ConfigureConnection(UFILE
*uclient
, PService psvc
, PAction ac
, pvar_entry_t args
, int nargs
)
80 // {"NewUserName", VAR_UserName, VAR_IN},
81 // {"NewPassword", VAR_Password, VAR_IN},
83 uint success
= TRUE
; /* assume no error will occur */
85 if (strlen(ac
->params
[0].value
) > 32 || strlen(ac
->params
[1].value
) > 32) {
86 soap_error( uclient
, SOAP_INVALID_ARGS
);
89 nvram_set("pppoe_username", ac
->params
[0].value
);
90 nvram_set("pppoe_passwd", ac
->params
[1].value
);
98 int WANPPPConnection_SetIdleDisconnectTime(UFILE
*uclient
, PService psvc
, PAction ac
, pvar_entry_t args
, int nargs
)
99 // {"NewIdleDisconnectTime", VAR_IdleDisconnectTime, VAR_IN},
101 uint success
= TRUE
; /* assume no error will occur */
103 nvram_set("pppoe_idletime", ac
->params
[0].value
);
110 int WANPPPConnection_RequestConnection(UFILE
*uclient
, PService psvc
, PAction ac
, pvar_entry_t args
, int nargs
)
114 /* should probably confirm that the pppoe_username and ppoe_passwd
116 nvram_set(igd_pri_wan_var(tmp
, sizeof(tmp
), "proto"), "pppoe");
123 int WANPPPConnection_ForceTermination(UFILE
*uclient
, PService psvc
, PAction ac
, pvar_entry_t args
, int nargs
)
131 int WANPPPConnection_SetConnectionType(UFILE
*uclient
, PService psvc
, PAction ac
, pvar_entry_t args
, int nargs
)
132 /* "SetConnectionType", WANPPPConnection_SetConnectionType, */
134 snprintf(psvc
->vars
[VAR_ConnectionType
].value
, sizeof(psvc
->vars
[VAR_ConnectionType
].value
), ac
->params
[0].value
);