Watt-32 tcp/ip  2.2 dev-rel.10
Data Structures | Functions | Variables
dynip.c File Reference

Go to the source code of this file.

Data Structures

struct  URL
 

Functions

static void (W32_CALL *prev_hook)(const char *
 
static const char *static int get_url (const char *host, int port, const char *path, const char *user_pass)
 Fetch a single URL optionally with authentication.
 
static const char * parse_myip_address (const char *orig)
 Parse response buffer and find the first IP-address. More...
 
static int parse_dyndns_response (const char *buf)
 Parse the status response from DynDNS.
 
static int chkip_method (const char *value)
 Select method of getting your public IP (WAN-side) address. More...
 
static int dyndns_params (const char *value)
 Extracts the host, port and request from the value. More...
 
static void url_free (struct URL *url)
 Free the URL.
 
static BOOL url_parse (struct URL *res, const char *url)
 Simple URL parser; accepts only "http://" prefixes (optional). More...
 
static void W32_CALL dynip_config (const char *name, const char *value)
 Parser for DYNIP configuration. More...
 
static void dynip_exit (void)
 Free allocated memory.
 
void dynip_init (void)
 
int dynip_exec (void)
 
static int base64encode (const char *in, char *out, size_t out_len)
 
static BOOL get_header (void *sock, long *cont_len_ptr)
 Receive and parse the HYTTP header. More...
 

Variables

static char dyndns_user [MAX_VALUELEN+1] = ""
 
static char dyndns_passwd [MAX_VALUELEN+1] = ""
 
static char dyn_myhostname [MAX_VALUELEN+1] = ""
 
static char dyn_myip [20] = ""
 
static BOOL dynip_enable = FALSE
 
static int dyndns_refresh = 3600
 
static int trace_level = 0
 
static char config_file [MAX_PATHLEN+1] = "$(TEMP)\\W32DYNIP.TMP"
 
static struct URL dyndns
 
static struct URL chkip = { NULL, NULL, 0, FALSE }
 
static char resp_buf [2048]
 

Detailed Description

Simple dynamic IP/hostname update client. Only updating using the DynDNS2 protocol is supported.

This code is based on the ddclient Perl-script by Paul Burry: http://members.rogers.com/ddclient/pub/ddclient.tar.gz

Definition in file dynip.c.

Function Documentation

static int chkip_method ( const char *  value)
static

Select method of getting your public IP (WAN-side) address.

Either a dotted IPv4 address or an URL to return your address.

Definition at line 368 of file dynip.c.

References _strlcpy(), isaddr(), url_free(), and url_parse().

static int dyndns_params ( const char *  value)
static

Extracts the host, port and request from the value.

Used for sending the DynDNS IP/host update.

Definition at line 384 of file dynip.c.

References url_free(), and url_parse().

static void W32_CALL dynip_config ( const char *  name,
const char *  value 
)
static

Parser for DYNIP configuration.

Matches all "\c DYNIP.xx" values from WATTCP.CFG file and make appropriate actions.

Definition at line 93 of file dynip.c.

References ARG_ATOI, ARG_FUNC, ARG_STRCPY, chkip_method(), dyndns_params(), and parse_config_table().

static BOOL get_header ( void sock,
long *  cont_len_ptr 
)
static

Receive and parse the HYTTP header.

Return FALSE if header isn't correct. Return TRUE and extract "Content-Length" field.

Definition at line 472 of file dynip.c.

static const char * parse_myip_address ( const char *  orig)
static

Parse response buffer and find the first IP-address.

'buf' must be 0-terminated.

Definition at line 215 of file dynip.c.

References _strlcpy(), and aton().

static BOOL url_parse ( struct URL res,
const char *  url 
)
static

Simple URL parser; accepts only "http://" prefixes (optional).

Extracts host, port and request parts ("/" if not present).

Definition at line 299 of file dynip.c.

References _strlcpy().

Variable Documentation

struct URL dyndns
static
Initial value:
= { (char*) "members.dyndns.com",
(char*) "/nic/update?system=dyndns&hostname=%s",
80, FALSE
}

Definition at line 68 of file dynip.c.