/*==============================================================================
//
// (C) WavePlus Technology. All Rights Reserved.
//
//------------------------------------------------------------------------------
//
// Project:
// WP3225 home gateway system software
//
//------------------------------------------------------------------------------
// Description:
//
//
//------------------------------------------------------------------------------
//
// Revision Details
// ----------------
//
// $Log: provider.c,v $
// Revision 1.17 2005/06/15 08:40:31 yfchou
// add minidns and 3domain
//
// Revision 1.16 2005/06/15 08:28:57 yfchou
// add minidns and 3domain
//
// Revision 1.15 2005/06/15 08:12:15 yfchou
// add minidns and 3domain
//
// Revision 1.14 2005/06/10 06:46:07 roger
// use base64_encode() in /lib
//
// Revision 1.13 2005/05/02 02:55:37 roger
// remove redundant code
//
// Revision 1.12 2005/04/27 06:00:03 yfchou
// add 3322.org
//
// Revision 1.11 2004/12/31 06:43:14 dliu
// 1231
// typo ","
//
// Revision 1.10 2004/12/31 06:34:28 dliu
// 1231
// agent string
//
// Revision 1.9 2004/12/15 11:34:55 roger
// modify useragent string
//
// Revision 1.8 2004/12/15 03:40:39 yfchou
// Add oray ddns
//
// Revision 1.7 2004/12/09 10:36:53 yfchou
// add HN and ZoneEdit DDNS
//
// Revision 1.6 2004/10/13 08:17:51 roger
// DNS_config() will do cyg_dns_res_init(), so remove cyg_dns_res_init()
//
// Revision 1.5 2004/09/23 08:24:45 roger
// fix 88ip output error
//
// Revision 1.4 2004/09/15 05:14:47 dliu
// 09/15 (from tenda)
// 1. add 88ip support
// 2. read timeout change from 2 -> 9 sec
//
// Revision 1.3 2004/08/10 11:01:49 roger
// no message
//
// Revision 1.2 2004/07/05 04:23:29 roger
// no message
//
// Revision 1.1 2004/06/28 05:27:34 roger
// initial version
//
//
//
==============================================================================*/
//==============================================================================
// INCLUDE FILES
//==============================================================================
#include <stdio.h>
#include <network.h>
#include <include/ddns.h>
//==============================================================================
// MACROS
//==============================================================================
#define BUFFER_SIZE 4*1024
//==============================================================================
// TYPE DEFINITIONS
//==============================================================================
//==============================================================================
// LOCAL VARIABLES
//==============================================================================
int EZIP_update_entry(struct user_info *info);
static struct service_t EZIP_service = {
EZIP_NAME,
EZIP_update_entry,
EZIP_DEFAULT_SERVER,
EZIP_DEFAULT_PORT,
EZIP_REQUEST
};
int DYNDNS_update_entry(struct user_info *info);
static struct service_t DYNDNS_service = {
DYNDNS_NAME,
DYNDNS_update_entry,
DYNDNS_DEFAULT_SERVER,
DYNDNS_DEFAULT_PORT,
DYNDNS_REQUEST
};
static struct service_t QDNS_service = {
QDNS_NAME,
DYNDNS_update_entry,
QDNS_DEFAULT_SERVER,
QDNS_DEFAULT_PORT,
QDNS_REQUEST
};
int DTDNS_update_entry(struct user_info *info);
static struct service_t DTDNS_service = {
DTDNS_NAME,
DTDNS_update_entry,
DTDNS_DEFAULT_SERVER,
DTDNS_DEFAULT_PORT,
DTDNS_REQUEST
};
int NOIP_update_entry(struct user_info *info);
static struct service_t NOIP_service = {
NOIP_NAME,
NOIP_update_entry,
NOIP_DEFAULT_SERVER,
NOIP_DEFAULT_PORT,
NOIP_REQUEST
};
int TZO_update_entry(struct user_info *info);
static struct service_t TZO_service = {
TZO_NAME,
TZO_update_entry,
TZO_DEFAULT_SERVER,
TZO_DEFAULT_PORT,
TZO_REQUEST
};
int CHANGEIP_update_entry(struct user_info *info);
static struct service_t CHANGEIP_service = {
CHANGEIP_NAME,
CHANGEIP_update_entry,
CHANGEIP_DEFAULT_SERVER,
CHANGEIP_DEFAULT_PORT,
CHANGEIP_REQUEST
};
int ODS_update_entry(struct user_info *info);
static struct service_t ODS_service = {
ODS_NAME,
ODS_update_entry,
ODS_DEFAULT_SERVER,
ODS_DEFAULT_PORT,
ODS_REQUEST
};
int HN_update_entry(struct user_info *info);
static struct service_t HN_service = {
HN_NAME,
HN_update_entry,
HN_DEFAULT_SERVER,
HN_DEFAULT_PORT,
HN_REQUEST
};
int ZOE_update_entry(struct user_info *info);
static struct service_t ZOE_service = {
ZOE_NAME,
ZOE_update_entry,
ZOE_DEFAULT_SERVER,
ZOE_DEFAULT_PORT,
ZOE_REQUEST
};
int ORAY_update_entry(struct user_info *info);
static struct service_t ORAY_service = {
ORAY_NAME,
ORAY_update_entry,
ORAY_DEFAULT_SERVER,
ORAY_DEFAULT_PORT,
ORAY_REQUEST
};
static struct service_t OVH_service = {
OVH_NAME,
DYNDNS_update_entry,
OVH_DEFAULT_SERVER,
OVH_DEFAULT_PORT,
OVH_REQUEST
};
static struct service_t EURODYNDNS_service = {
EURODYNDNS_NAME,
DYNDNS_update_entry,
EURODYNDNS_DEFAULT_SERVER,
EURODYNDNS_DEFAULT_PORT,
EURODYNDNS_REQUEST
};
int REGFISH_update_entry(struct user_info *info);
static struct service_t REGFISH_service = {
REGFISH_NAME,
REGFISH_update_entry,
REGFISH_DEFAULT_SERVER,
REGFISH_DEFAULT_PORT,
REGFISH_REQUEST
};
int M88IP_update_entry(struct user_info *info);
static struct service_t M88IP_service = {
M88IP_NAME,
M88IP_update_entry,
M88IP_DEFAULT_SERVER,
M88IP_DEFAULT_PORT,
M88IP_REQUEST
};
int JUSTL_update_entry(struct user_info *info);
static struct service_t JUSTL_service = {
JUSTL_NAME,
JUSTL_update_entry,
JUSTL_DEFAULT_SERVER,
JUSTL_DEFAULT_PORT,
JUSTL_REQUEST
};
static struct service_t DHK_service = {
DHK_NAME,
JUSTL_update_entry, //same as JUSTL???
DHK_DEFAULT_SERVER,
DHK_DEFAULT_PORT,
DHK_REQUEST
};
static struct service_t *service_list[]={
&DYNDNS_service,
&QDNS_service,
&NOIP_service,
&TZO_service,
&CHANGEIP_service,
&ODS_service,
&HN_service,
&ZOE_service,
&ORAY_service,
&OVH_service,
&EURODYNDNS_service,
®FISH_service,
&M88IP_service,
&JUSTL_service,
&DHK_service,
NULL,
};
//==============================================================================
// LOCAL FUNCTION PROTOTYPES
//==============================================================================
//==============================================================================
// EXTERNAL FUNCTIONS
//==============================================================================
//------------------------------------------------------------------------------
// FUNCTION
//
//
// DESCRIPTION
//
//
// PARAMETERS
//
//
// RETURN
//
//
//------------------------------------------------------------------------------
struct service_t *find_service(char *name)
{
struct service_t *serv;
int i;
for(i=0; service_list[i]; i++)
{
serv = service_list[i];
if(strcmp(serv->name, name) == 0)
return serv;
}
return NULL;
}
//------------------------------------------------------------------------------
// FUNCTION
//
//
// DESCRIPTION
//
//
// PARAMETERS
//
//
// RETURN
//
//
//------------------------------------------------------------------------------
int do_connect(int *sock, char *host, unsigned short port)
{
struct sockaddr_in addr;
int len;
int result;
struct hostent *hostinfo;
// set up the socket
if((*sock=socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("socket");
return(-1);
}
// get the host address
hostinfo = gethostbyname(host);
if(!hostinfo)
{
DDNS_DBG("gethostbyname error");
close(*sock);
return(-1);
}
addr.sin_family = AF_INET;
addr.sin_addr = *(struct in_addr *)*hostinfo->h_addr_list;