Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

SRC/pcconfig.h File Reference


Detailed Description

Definition in file pcconfig.h.

Go to the source code of this file.

Data Structures

struct  config_table

Typedefs

typedef FILE * WFILE
typedef long(* WattUserConfigFunc )(int pass, const struct config_table *cfg)

Enumerations

enum  config_tab_types {
  ARG_ATOI,
  ARG_ATOB,
  ARG_ATOW,
  ARG_ATOIP,
  ARG_ATOX_B,
  ARG_ATOX_W,
  ARG_ATOX_D,
  ARG_STRDUP,
  ARG_STRCPY,
  ARG_RESOLVE,
  ARG_FUNC
}

Functions

const char * get_argv0 (void)
 Return argv[0] as passed to main().
void _add_server (WORD *counter, WORD max, DWORD *array, DWORD value)
int netdb_init (void)
 Called from most <netdb.h> functions in case watt_sock_init() wasn't called first to initialise things.
void netdb_warn (const char *fname)
W32_FUNC int tcp_config_name (char *name, int max)
W32_FUNC long tcp_config (const char *path)
W32_FUNC void tcp_set_debug_state (WORD x)
 Used when DEBUG=x is defined in the config file Moved from pctcp.c.
W32_FUNC int parse_config_table (const struct config_table *tab, const char *section, const char *name, const char *value)
 Parse the config-table and if a match is found for ('section'+'.'+)'name' either store variable to 'value' or call function with 'value'.
W32_FUNC const char * ExpandVarStr (const char *str)
 Return a string with a environment variable expanded (only one).
long tcp_parse_file (WFILE f, const struct config_table *cfg)
void tcp_inject_config (const struct config_table *cfg, const char *key, const char *value)
 Callable from a user application to inject config values before the normal WATTCP.CFG is loaded and parsed.
W32_FUNC WattUserConfigFunc _watt_user_config (WattUserConfigFunc fn)
 A user application may call the `_watt_user_config()' function prior to calling sock_init() to inject its own configuration values into the tcp_config() parser.

Variables

W32_DATA int sock_inactive
W32_DATA int sock_data_timeout
W32_DATA int sock_delay
W32_DATA WORD multihomes
W32_DATA void(* print_hook )(const char *)
W32_DATA void(* usr_init )(const char *, const char *)
W32_DATA void(* usr_post_init )(void)
W32_DATA DWORD cookies [MAX_COOKIES]
W32_DATA WORD last_cookie
W32_DATA int debug_on
W32_DATA int ctrace_on
W32_DATA BOOL dynamic_host
const struct config_table * watt_init_cfg
WattUserConfigFunc _watt_user_config_fn


Enumeration Type Documentation

enum config_tab_types
 

Convert 'arg_func' below to this type.

Enumeration values:
ARG_ATOI  convert to int
ARG_ATOB  convert to 8-bit byte
ARG_ATOW  convert to 16-bit word
ARG_ATOIP  convert to ip-address (host order)
ARG_ATOX_B  convert to hex-byte
ARG_ATOX_W  convert to hex-word
ARG_ATOX_D  convert to hex-dword
ARG_STRDUP  duplicate string value
ARG_STRCPY  copy string value
ARG_RESOLVE  resolve host to IPv4-address
ARG_FUNC  call convertion function
Definition at line 14 of file pcconfig.h.


Function Documentation

W32_FUNC WattUserConfigFunc _watt_user_config WattUserConfigFunc  fn  ) 
 

A user application may call the `_watt_user_config()' function prior to calling sock_init() to inject its own configuration values into the tcp_config() parser.

Useful when running diskless and setting `_watt_no_config = 0'.

Example:

  • 'pass' is 1 for first pass (PKTDRVR/WinPcap configuration), 2 for second pass.
  • 'cfg' is a pointer to the configuration table and must be passed to tcp_inject_config() as-is.

In most cases 'pass' can probably be ignored.

static long my_config_fn (int pass, const struct config_table *cfg) { // Keyword case is not significant (tcp_inject_config will convert // all keys to uppercase)

tcp_inject_config (cfg, "My_IP", "192.168.0.98"); tcp_inject_config (cfg, "NetMask", "255.255.255.0"); tcp_inject_config (cfg, "Gateway", "192.168.0.1"); (void)pass; return (1); // Returning 0 would make tcp_config() return 0 too, // as if the config file was not found }

int main (void) { _watt_no_config = 1; _watt_user_config (my_config_fn); if (sock_init()) return (-1); ... }

Never called inside Watt-32. Definition at line 186 of file SOCK_INI.C.

W32_FUNC const char* ExpandVarStr const char *  str  ) 
 

Return a string with a environment variable expanded (only one).

E.g. if environment variable ETC is "c:\network\watt\bin", "$(ETC)\hosts" becomes "c:\network\watt\bin\hosts" If ETC isn't defined, "$(ETC)\hosts" becomes "\hosts".

Todo:
support several in one line and malloc the result.
Definition at line 192 of file PCCONFIG.C.

void tcp_inject_config const struct config_table *  cfg,
const char *  key,
const char *  value
 

Callable from a user application to inject config values before the normal WATTCP.CFG is loaded and parsed.

See '_watt_user_config' in sock_ini.c. Definition at line 850 of file PCCONFIG.C.


Generated on Wed Aug 4 08:55:57 2010 for Watt-32 tcp/ip by doxygen 1.3.8