📄 netcfg.h
字号:
//--------------------------------------------------------------------------
// Network Control Library
//--------------------------------------------------------------------------
// NETCFG.H
//
// Standard Configuration Structures
//
// Although the Configuration functions are generic, NETTOOLS expects
// to be able to access a configuration with certain pre-defined
// configuration tags.
//
// If a system needs to use the Service functions of NetTools, it must
// provide service providers to implement the configuration speicifcation
// defined here.
//
// Author: Michael A. Denio
// Copyright 2000 by Texas Instruments Inc.
//--------------------------------------------------------------------------
#ifndef _C_NETCFG_INC
#define _C_NETCFG_INC
//
// Note: *** Default Configuration Handle Required ***
//
// NetTools uses the default configuration handle for things like
// DHCP client, DHCP server, DNS, etc.. This handle should be
// set by calling CfgSetDefault() before using NetTools
//
//---------------------------------------------------------------------------
// Defined Configuration Tags
//---------------------------------------------------------------------------
#define CFGTAG_OS 0x0001 // OS Configuration
#define CFGTAG_IP 0x0002 // IP Stack Configuration
#define CFGTAG_SERVICE 0x0003 // Service
#define CFGTAG_IPNET 0x0004 // IP Network
#define CFGTAG_ROUTE 0x0005 // Gateway Route
#define CFGTAG_CLIENT 0x0006 // DHCPS Client
#define CFGTAG_SYSINFO 0x0007 // System Information
#define CFGTAG_ACCT 0x0008 // User Account
//---------------------------------------------------------------------------
// Users *are* allowed to add their own tags, however the MAX tag value
// (CFGTAG_MAX) can not be altered without rebuilding the NETTOOLS library
//---------------------------------------------------------------------------
#define CFGTAG_MAX 0x0010
//---------------------------------------------------------------------------
// Configuration Item Values and Entry Data by Tag Value
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
// Config Tag: CFGTAG_SERVICE
// List of active services
// Item = Service Type
// Instance = Service Instance (1 to max)
//
// *** USERS CAN ADD THEIR OWN SERVICE ITEM VALUES ***
//
#define CFGITEM_SERVICE_TELNET 0x0001
#define CFGITEM_SERVICE_HTTP 0x0002
#define CFGITEM_SERVICE_NAT 0x0003
#define CFGITEM_SERVICE_DHCPSERVER 0x0004
#define CFGITEM_SERVICE_DHCPCLIENT 0x0005
#define CFGITEM_SERVICE_DNSSERVER 0x0006
#define CFGITEM_SERVICE_MAX 0x0006
//
// Common Service Arguments
//
// All services have a common argument structure which dictates their
// operation under certain circumstances. Also, the use can install a
// callback for services to be informed on status change. The callback
// function is defined as:
//
// CallbackFunction( uint Item, uint Status, uint code, HANDLE hCfgEntry )
// Item = Item value of entry changed
// Status = New status
// Code = Report code (if any)
// hCfgEntry = Non-Ref'd HANDLE to entry with status change
//
// The value of "Status" does not proceed past "ENABLED". For Task
// specific information, the standard NETTOOLS report code is used.
//
// Common Service Arguments
typedef struct _ci_srvargs {
uint Item; // Copy Item (resets to NULL)
HANDLE hService; // Handle to service (resets to NULL)
uint Mode; // Flags
#define CIS_FLG_IFIDXVALID 0x0001 // IfIdx field is supplied to CONFIG
#define CIS_FLG_RESOLVEIP 0x0002 // Resolve If to IP before execution
#define CIS_FLG_CALLBYIP 0x0004 // Call using IP (set w/RESOLVEIP)
#define CIS_FLG_RESTARTIPTERM 0x0008 // Restart serivce on IPTERM
uint Status; // Service Status (resets to NULL)
#define CIS_SRV_STATUS_DISABLED 0x0000 // Config not active
#define CIS_SRV_STATUS_WAIT 0x0001 // Waiting on IP resolve
#define CIS_SRV_STATUS_IPTERM 0x0002 // Service terminated via IP synch
#define CIS_SRV_STATUS_FAILED 0x0003 // Service failed to initialize
#define CIS_SRV_STATUS_ENABLED 0x0004 // Service enabled
uint ReportCode; // Standard NETTOOLS Report Code
uint IfIdx; // If physical index
IPN IPAddr; // Host IP Address
void(*pCbSrv)(uint, uint, uint, HANDLE); // CbFun for status change
} CISARGS;
// Telnet Entry Data
typedef struct _ci_service_telnet {
CISARGS cisargs; // Common arguments
NTPARAM_TELNET param; // Telnet parameters
} CI_SERVICE_TELNET;
// HTTP Server Entry Data
typedef struct _ci_service_http {
CISARGS cisargs; // Common arguments
} CI_SERVICE_HTTP;
// NAT Service Entry Data
typedef struct _ci_service_nat {
CISARGS cisargs; // Common arguments
NTPARAM_NAT param; // NAT parameters
} CI_SERVICE_NAT;
// DHCP Server Entry Data
typedef struct _ci_service_dhcps {
CISARGS cisargs; // Common arguments
NTPARAM_DHCPS param; // DHCPS parameters
} CI_SERVICE_DHCPS;
// DHCP Client Service
typedef struct _ci_service_dhcpc {
CISARGS cisargs; // Common arguments
NTPARAM_DHCP param; // DHCP parameters
} CI_SERVICE_DHCPC;
// DNS Server Service
typedef struct _ci_service_dnss {
CISARGS cisargs; // Common arguments
} CI_SERVICE_DNSSERVER;
//---------------------------------------------------------------------------
//
// Config Tag: CFGTAG_IPNET
// IP networks assigned to physical devices
// Item = Physical Interface Idx (1 to n)
// Instance = Address Instance (1 to n)
//
// Max IPNet Domain name Length - Change requires NETTOOLS rebuild
#define CFG_DOMAIN_MAX 64
// IPNet Instance
typedef struct _ci_ipnet {
uint NetType; // Network address type flags
IPN IPAddr; // IP Address
IPN IPMask; // Subnet Mask
HANDLE hBind; // Binding handle (resets to NULL)
char Domain[CFG_DOMAIN_MAX]; // IPNet Domain Name
} CI_IPNET;
// NetType consists of flags. One or more of the following can be set...
// Note: VIRTUAL and non-VIRTUAL networks can not appear on the same interface
#define CFG_NETTYPE_DYNAMIC 0x0001 // Address created by DHCP CLIENT
#define CFG_NETTYPE_VIRTUAL 0x0002 // Virtual (one per IF)
#define CFG_NETTYPE_DHCPS 0x0004 // DHCPS Server IP
//---------------------------------------------------------------------------
//
// Config Tag: CFGTAG_ROUTE
// Static Gateway routes for hosts and networks
// Item = 0
// Instance = Route instance index (1 to n)
//
// Route Instance
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -