LIAPP Frame Definition and Implementation
History
Date
Version
Author/ Revisor
Note
2004-7-31
1.0
Mitch
Add the SID and DID, and change version to 0xF600
2004-8-18
1.1
Mitch
Extent User Defined Request/Response to get the data that exceeds 1500 bytes
1. Macro Definition
//-------------------------------------------------------------
// common type definition for LIAPP
//-------------------------------------------------------------
#define U8 unsigned char //1 byte
#define U16 unsigned short //2 bytes
#define U32 unsigned long //4 bytes
#define IN
#define OUT
#define INOUT
2. Frame Description 2.1. Frame Structure//-------------------------------------------------------------
// Frame structure of protocol LIAPP
//-------------------------------------------------------------
Protocol ID
(0xF557)0xF600
2 bytes
Control
xx000000
1 byte
Destination
ID
4 bytes
Source
ID
4 bytes
Length
2 bytes
Sequence
2 bytes
Frame ID
2 bytes
Frame Body
N bytes
FCS
2 bytes
0 – 1
2
3 – 6
7 – 10
11 – 12
13 – 14
15 -- 16
Frame_Header
Frame_Body
2.2. Frame Head Definition 2.2.1. Frame Head structure
//----------------------------------------------------------------------------------------------------
// Frame header structure of LIAPP, not include frame body and FCS.
//----------------------------------------------------------------------------------------------------
Typedef struct{
U16 PID;
U8 Ctrl;
U32 DID;
U32 SID;
U16 Len;
U16 Seq;
U16 FID;
}LIAPP_HEADER;
//-------------------------------------------------------------
// Macro definition for LIAPPheader
//-------------------------------------------------------------
#define LIAPP_MAXFRAMESIZE 1500 //MAXSIZE for whole frame
#define LIAPP_PROTOCOLID (U16)0xF557
#define LIAPP_PROTOCOLVERSION (U16)0 //initial version is 0, not formal.
2.2.2. Frame Id Field//-------------------------------------------------------------
// Definition of frame IDs of LIAPP frames
//-------------------------------------------------------------
#define LIAPP_FID_BROWSEREQ 0X0000
#define LIAPP_FID_BROWSERSP 0X0001
#define LIAPP_FID_INQUIRYREQ 0X0002
#define LIAPP_FID_INQUIRYRSP 0X0003
#define LIAPP_FID_CONNECTION 0X0004
#define LIAPP_FID_DISCONNECTION 0X0005
#define LIAPP_FID_CONFIGREQ 0X0006
#define LIAPP_FID_CONFIGRSP 0X0007
#define LIAPP_FID_FOPENREQ 0X0008
#define LIAPP_FID_FOPENRSP 0X0009
#define LIAPP_FID_FCLOSEREQ 0X000A
#define LIAPP_FID_FCLOSERSP 0X000B
#define LIAPP_FID_FREADREQ 0X000C
#define LIAPP_FID_FREADRSP 0X000D
#define LIAPP_FID_FWRITEREQ 0X000E
#define LIAPP_FID_FWRITERSP 0X000F
#define LIAPP_FID_DIRREQ 0X0010
#define LIAPP_FID_DIRRSP 0X0011
#define LIAPP_FID_FSEEKREQ 0X0012
#define LIAPP_FID_FSEEKRSP 0X0013
#define LIAPP_FID_UDEFREQ 0X0014
#define LIAPP_FID_UDEFRSP 0X0015
//-------------------------------------------------------------
// for testing the protocol
//-------------------------------------------------------------
#ifdef TESTCOMMQ
#define LIAPP_FID_GETCQREQ 0x001a
#define LIAPP_FID_GETCQRSP 0x001b
#endif
2.3. Frame Body Description 2.3.1. Precondition 2.3.1.1. Status Code//-------------------------------------------------------------
// Definition of LIAPP_STATUS
//-------------------------------------------------------------
typedef int LIAPP_STATUS;
enum _LIAPP_STATUS {
LIAPP_STATUS_SUCCESS, //0
LIAPP_STATUS_FAILURE, //1
LIAPP_STATUS_TIMEOUT, //2
LIAPP_STATUS_BUSY, //3
LIAPP_STATUS_INVALID_USER, //4
LIAPP_STATUS_REJECT, //5
LIAPP_STATUS_DISCONNECTION, //6
LIAPP_STATUS_INVALID, //7
LIAPP_STATUS_OVERFLOW, //8
LIAPP_STATUS_NOTFOUND //9
};
2.3.1.2. Prompt & Error Messages//-------------------------------------------------------------
// In the Lib.h
// Prompt & Error Messages
//-------------------------------------------------------------
Note: if you want to know the lastest macros of PEMs, please refer your question to the Lib.h of Nobrand Smart Utility for all models
#define Meg "Message..."
#define Meg_Nu "You must input a password!"
#define Meg_xpas "Invalid password!"
#define Meg_cpas "The new configuration has applied successfully.\n" \
" Reset AP in process..."
#define Meg_cxpas "Fail to apply new configuration!"
#define Meg_rpas "Reset AP in process..."
#define Meg_rxpas "Fail to reset!"
#define Meg_upas "The firmware has upgraded sucessfully.\n" \
" Reset AP in process..."
#define Meg_uxpas "Fail to upgrade!"
#define Meg_dump "AP Name"
#define Meg_outrts "RTS threshold is out of range!"
#define Meg_outfrag "Frag threshold is out of range!"
#define Meg_difpas "Password mismatch!"
#define Meg_openfail "Fail to open the file!"
#define Meg_overflow "File size overflow!"
#define Meg_Noimport "Invalid import file!"
#define Meg_outimport "Import file too large!"
#define Meg_accessapy "The new configuration has applied successfully.\n" \
" Reset AP in process..."
#define Meg_accessapy2 "The new configuration has applied successfully.\n"
#define Meg_xaccessapy "Fail to apply!"
#define Meg_xaccess "Invalid MAC address!"
#define Meg_xdaccess "Duplicate address!"
#define Meg_dcheck "The AP will be reset. Are you sure to proceed??"
#define Meg_dcheck2 "Are you sure to update Access Control Table??"
#define Meg_xip "Invaild IP address."
#define Meg_xgateway "Invalid Gateway address."
#define Meg_xnetmask "Invalid Netmask address."
#define Meg_Wep1 "Key %d : Invalid key format."
#define Meg_Wep2 "Key %d : Key size should be %d bytes."
#define Meg_string1 "Browse Result"
#define Meg_string2 "Inquiry Result"
#define Meg_string3 "Connect Result"
#define Meg_string4 "Disconnect Result"
#define Meg_string5 "Configuration Result"
#define Meg_string6 "Open File Result"
#define Meg_string7 "Close File Result"
#define Meg_string8 "Read File Result"
#define Meg_string9 "Write File Result"
#define Meg_string10 "List File Result"
#define Meg_string11 "Seek File Result"
#define Meg_result1 "Success!"
#define Meg_result2 "Failure!"
#define Meg_result3 "Timeout!"
#define Meg_result4 "Busy!"
#define Meg_result5 "Invalid User!"
#define Meg_result6 "Reject!"
#define Meg_result7 "Disconnection!"
//#define Meg_result8 "Invalid request parameter"
#define Meg_result8 "Settings cannot be changed with this version of utility"
#define Meg_result9 "Overflow"
#define Meg_result10 "Not found "
2.3.1.3. Device Id//-------------------------------------------------------------
// Definition of device Id information
//-------------------------------------------------------------
Note:In the LIAPP, length =6;and ID[0..5]=BSSID
typedef struct{
char length;
char ID[16]; //last char implies network interface
} DEVID;
2.3.1.4. Device Description//-------------------------------------------------------------
// Definition of format of device description
//-------------------------------------------------------------
Note: Need modification for the XG582
typedef struct{
DEVID deviceId;
char manufacturer[80];
char product[80];
char model[80];
char name[80]; //Device(AP) name
char detail[256]; //Device(AP) description
} DEVDESC;
2.3.1.5. Element FormatNote:In the Utility and Firmware, we don’t accord with following Element Class
Element ID
Element Length
Element Value
2 bytes
1 byte
N bytes
Element Class
Element Number
Bit 15 – bit 12
Bit 11 – bit 0
Element ID field description
Element Class
Description
0
General Information
1
Wireless LAN1 Information
Element class description
//---------------------------------------------------------------------------------------------
typedef U16 EID; // EID is nothing but a shot
//---------------------------------------------------------------------------------------------
typedef struct{
EID eid;
U8 len;
U8 value[255];
} ELEMENT;
#define EID_End (U16)0xFFFF //impossible EID for normal element
2.3.1.6. AP Configuration DefinitionNote: Do not use in the Utility.
//---------------------------------------------------------------------------
// Appear in the file Apcfg.h
//---------------------------------------------------------------------------
typedef struct _AP_CONFIG
{
u_char wla_if_no;
APCFG_WlaIf wla_ifp[MAX_NO_WIFACE];
#ifndef MAP
APCFG_IP ip;
#ifdef STATIC_ROUTE
APCFG_ROUTE route;
#endif
APCFG_DHCPD dhcpd;
APCFG_SNMP snmp;
APCFG_Mgmt mgmt;
APCFG_Various var;
APCFG_AccessCtrl access;
APCFG_PPPoE pppoe;
//UserAuth Related
APCFG_RadiusCtrl radius;
//UserAuth Related end
APCFG_ThroughputCtl throughputctl;
#endif
} AP_CONFIG;
2.3.1.7. Mib StructureNote: See XI1500, not in XG580SERIES
//---------------------------------------------------------------------------
// Appear in the file Mib.h
//---------------------------------------------------------------------------
// Define MIB attribute for MIBATT
// Amdin user ignore MIBATT, can full access
//---------------------------------------------------------------------------
#define EATT_NA 0 //not used
#define EATT_RO 1 //read only
#define EATT_WO 2 //write only
#define EATT_RW 3 //full access
//---------------------------------------------------------------------------
// Define general MIB
// f(ENAME,EATT,EMAX,ELEN,EVALUE)
// Note 1: you cannot delete any EID from here,
// because the EID is unique for each element
// for a unused EID, please set EATT=EATT_NA
// Note 2: total items < 0x1000, EID=0x0000-0x0FFF
//---------------------------------------------------------------------------
#define defGenMIB(f) \
f(MIBVersion_Major,EATT_RO,1,1,unsigned char,{1})\
f(MIBVersion_Middle,EATT_RO,1,1,unsigned char,{0})\
f(MIBVersion_Minor,EATT_RO,1,1,unsigned char,{0})\
f(FWVersion_Major,EATT_RO,1,1,unsigned char,{1})\
f(FWVersion_Middle,EATT_RO,1,1,unsigned char,{0})\
f(FWVersion_Minor,EATT_RO,1,1,unsigned char,{0})\
f(FW_Build_Date,EATT_RO,32,1,char,{0})\
f(FW_Upload_Date,EATT_RO,32,1,char,{0})\
f(Manufacturer,EATT_RO,sizeof("Z-Com"),sizeof("Z-Com")-1,char,"Z-Com")\
f(Product,EATT_RO,sizeof("LANEscape"),sizeof("LANEscape")-1,char,"LANEscape")\
f(Model,EATT_RO,sizeof("XI-1000"),sizeof("XI-1000")-1,char,"XI-1000")\
f(Name,EATT_RW,16,sizeof("AP0001")-1,char,"AP0001")\
f(Detail,EATT_RW,80,0,char,"")\
f(Username,EATT_RO,sizeof("guest"),sizeof("guest")-1,char,"guest")\
f(Password,EATT_RW,16,sizeof("1234")-1,char,"1234")
//---------------------------------------------------------------------------
// define 802.11 MIB (Wireless LAN 1)
// f(ENAME,EATT,EMAX,ELEN,EVALUE)
// Note 1: you cannot delete any EID from here,
// because the EID is unique for each element
// for a unused EID, please set EATT=EATT_NA
// Note 2: total items < 0x1000, EID=0x1000-0x1FFF
//---------------------------------------------------------------------------
#define dChannelList {1,2,3,4,5,6,7,8,9,10,11,12,13,14,0}
#define dSupportRate {2,4,11,22,0}
#define defWla1MIB(f) \
f(WLA1_MacAddr,EATT_RO,6,6,char,"")\
f(WLA1_FreqDomain,EATT_RO,1,1,char,{FD_FCC})\
f(WLA1_ChannelList,EATT_RO,15,15,char,dChannelList)\
f(WLA1_ChannelNumber,EATT_RW,1,1,char,{1})\
f(WLA1_SupportRates,EATT_RO,5,5,char,dSupportRate)\
f(WLA1_BasicRates,EATT_RW,5,5,char,"\4")\
f(WLA1_TxRate,EATT_RW,1,1,char,{TXRATE_FullAuto})\
f(WLA1_ESSID,EATT_RW,30,30,char,"My Network")\
f(WLA1_RTSThreshold,EATT_RW,1,1,short,{2300})\
/*
f(WLA1_TransmittedFragmentCount,EATT_RO,1,1,long,{0})\
f(WLA1_MulticastTransmittedFrameCount,EATT_RO,1,1,long,{0})\
f(WLA1_RetryCount,EATT_RO,1,1,long,{0})\
f(WLA1_FailedCount,EATT_RO,1,1,long,{0})\
f(WLA1_MultipleRetryCount,EATT_RO,1,1,long,{0})\
f(WLA1_FrameDuplicateCount,EATT_RO,1,1,long,{0})\
f(WLA1_RTSSuccessCount,EATT_RO,1,1,long,{0})\
f(WLA1_RTSFailureCount,EATT_RO,1,1,long,{0})\
f(WLA1_ACKFailureCount,EATT_RO,1,1,long,{0})\
f(WLA1_ReceiveFragmentCount,EATT_RO,1,1,long,{0})\
f(WLA1_MulticastReceivedCount,EATT_RO,1,1,long,{0})\
f(WLA1_FCSErrorCount,EATT_RO,1,1,long,{0})
*/
//---------------------------------------------------------------------------
// define element Ids
//---------------------------------------------------------------------------
#define f_enum(ENAME,EATT,EMAX,ELEN,ETYPE,EVALUE) EID_##ENAME,
enum _EID_GEN_{
genfirsteid=0x0000-1,
defGenMIB(f_enum)
genlasteid
};
enum _EID_WLA1_{
wla1firsteid=0x1000-1,
defWla1MIB(f_enum)
wla1lasteid
};
//---------------------------------------------------------------------------
// define attributes of MIBs
//---------------------------------------------------------------------------
#define f_ATT(ENAME,EATT,EMAX,ELEN,ETYPE,EVALUE) EATT,
unsigned char MIB_GenAttr[TOTAL_GEN]={defGenMIB(f_ATT)};
unsigned char MIB_Wla1Attr[TOTAL_WLA1]={defWla1MIB(f_ATT)};
//---------------------------------------------------------------------------
// define elements's max length
//---------------------------------------------------------------------------
#define f_maxlen(ENAME,EATT,EMAX,ELEN,ETYPE,EVALUE)\
EMAX*sizeof(ETYPE),
unsigned char MIB_GenMaxLen[TOTAL_GEN]={defGenMIB(f_maxlen)};
unsigned char MIB_Wla1MaxLen[TOTAL_WLA1]={defWla1MIB(f_maxlen)};
//---------------------------------------------------------------------------
// define elements's length
//---------------------------------------------------------------------------
#define f_len(ENAME,EATT,EMAX,ELEN,ETYPE,EVALUE)\
ELEN*sizeof(ETYPE),
unsigned char MIB_GenLen[TOTAL_GEN]={defGenMIB(f_len)};
unsigned char MIB_Wla1Len[TOTAL_WLA1]={defWla1MIB(f_len)};
//---------------------------------------------------------------------------
// define values of MIBs
//---------------------------------------------------------------------------
#define f_values(ENAME,EATT,EMAX,ELEN,ETYPE,EVALUE)\
static ETYPE EVA_##ENAME[EMAX]=EVALUE;
defGenMIB(f_values)
defWla1MIB(f_values)
//---------------------------------------------------------------------------
// define element map
//---------------------------------------------------------------------------
#define f_map(ENAME,EATT,EMAX,ELEN,ETYPE,EVALUE)\
(void*)EVA_##ENAME,
void * MIB_GenMap[TOTAL_GEN]={defGenMIB(f_map)};
void * MIB_Wla1Map[TOTAL_WLA1]={defWla1MIB(f_map)};
2.3.2. Frame Format DefinitionNote: The following frame formats are based on <LANEscape Inter Access Point Protocol (LIAPP) Specification v0.3 Draft> , Released by Sean Huang, and maybe not be same with the implement of the protocol. The main reason, I adhere to implement the structure of these frame formats, is that people can easy to communicate with each other, according as the frame formats defined by the protocol.
2.3.2.1. Browse Request Frame FormatTypedef struct{
ELEMENT BROWSE_ manufacturer; //len=0
ELEMENT BROWSE_ product; //len=0
ELEMENT BROWSE_ model; //len=0
}LIAPP_FB_BROWSEREQ;
2.3.2.2. Browse Response Frame FormatNote: Need modification for XG582
Typedef struct{
ELEMENT BROWSE_ manufacturer;
ELEMENT BROWSE_ product;
ELEMENT BROWSE_ model;
ELEMENT BROWSE_ apname;
ELEMENT BROWSE_ detail;
}LIAPP_FB_BROWSERSP;
2.3.2.3. Inquiry Request Frame FormatTypedef struct{
U16 INQ_userId; //user ID
DEVID INQ_deviceId; //device Id
}LIAPP_FB_INQREQ;
2.3.2.4. Inquiry Response Frame FormatTypedef struct{
U16 INQ_userId; //user ID
U16 INQ_state; //status code
DEVID INQ_deviceId; //device Id
}LIAPP_FB_INQRSP;
2.3.2.5. Configuration Request Frame FormatTypedef struct{
U16 CONF_userId; //user ID
DEVID CONF_deviceId; //device Id
}LIAPP_FB_CONFREQ;
2.3.2.6. Configuration Response Frame FormatTypedef struct{
U16 CONF_userId; //user ID
U16 CONF_state; //status code
}LIAPP_FB_CONFRSP;
2.3.2.7. Connection Frame FormatTypedef struct{
U16 CONN_seq; //connection transaction sequence number
U16 CONN_state; //status code
U16 CONN_userId; //user ID
U8 *CONN_name[20]; //user name
U8 *CONN_password[20]; //password
}LIAPP_FB_CONNECTION;
//------------------------------------------------------------------------------------------
// In the Implement of the LIAPP, Red Field (User Name) is omiited.
//------------------------------------------------------------------------------------------
Connection transaction sequence number
Status code
User Id
User name
Password
1
Reserved 0
Reserved 0
Present
Present
2
Status
Present
Not present
Not present
3
Reserved 0
Present
Present
Not present
4
Status
Present
Not present
Not present
2.3.2.8. Disconnection Frame FormatTypedef struct{
U16 DISC_userId; //user ID
}LIAPP_FB_DISCONNECTION;
2.3.2.9. File Open Request Frame FormatTypedef struct{
U16 FOPEN_userId; //user ID
U16 FOPEN_attr //attribute r/w
U8 FOPEN_filename[20] //file name, max 16
}LIAPP_FB_FOPENREQ;
2.3.2.10. File Open Response Frame FormatTypedef struct{
U16 FOPEN_userId; //user ID
U16 FOPEN_state //status code
U16 FOPEN_fileId; //file ID
U32 FOPEN_size //file size
}LIAPP_FB_FOPENRSP
2.3.2.11. File Close Request Frame FormatTypedef struct{
U16 FCLOSE_userId; //user ID
U16 FCLOSE_fileId; //file ID
}LIAPP_FB_FCLOSEREQ;
2.3.2.12. File Close Response Frame FormatTypedef struct{
U16 FCLOSE_userId; //user ID
U16 FCLOSE_fileId; //file ID
U16 FCLOSE_state; //status code
}LIAPP_FB_FCLOSERSP;
2.3.2.13. File Write Request Frame Format
Typedef struct{
U16 FWRITE_userId; //user ID
U16 FWRITE_fileId; //file ID
U16 FWRITE_bytes2Write; // bytes to write, only 2 bytes
U32 FWRITE_byteOffset; //byte offset
U8* FWRITE_data2Write; //data to write
}LIAPP_FB_FWRITEREQ;
2.3.2.14. File Write Response Frame FormatTypedef struct{
U16 FWRITE_userId; //user ID
U16 FWRITE_fileId; //file ID
U16 FWRITE_state; //status code
U16 FWRITE_bytes2Write; // bytes to write, only 2 bytes
U32 FWRITE_byteOffset; //byte offset
}LIAPP_FB_FWRITERSP;
2.3.2.15. File Read Request Frame FormatTypedef struct{
U16 FREAD_userId; //user ID
U16 FREAD_fileId; //file ID
U16 FREAD_bytes2Read; // bytes to read
U32 FREAD_byteOffset; //byte offset
}LIAPP_FB_FREADREQ;
2.3.2.16. File Read Response Frame FormatTypedef struct{
U16 FREAD_userId; //user ID
U16 FREAD_fileId; //file ID
U16 FREAD_state; //status code
U16 FREAD_bytes2Read; // bytes to read
U32 FREAD_byteOffset; //byte offset
U8* FREAD_data2Read; //data to read
}LIAPP_FB_FREADRSP;
2.3.2.17. User Defined Request Frame FormatTypedef struct{
U16 UDEF_userId; //user ID
U16 UDEF_len; //body length
U8* UDEF_buff; //body
}LIAPP_FB_UDEFREQ;
2.3.2.18. User Defined Response Frame FormatTypedef struct{
U16 UDEF_userId; //user ID
U16 UDEF_state; //status code
U16 UDEF_len //return length
U8* UDEF_buff; //return buffer
}LIAPP_FB_UDEFRSP;
Below frame format is not defined and implemented in the LIAPP.
2.3.2.19. DIR Request Frame Format 2.3.2.20. DIR Response Frame Format 2.3.2.21. File Seek Request Frame Format 2.3.2.22. File Seek Response Frame Format 3. Variables and Routines 3.1. Definition 3.1.1. LIAPP Status//-------------------------------------------------------------
// Definition of LIAPP_STATE
//-------------------------------------------------------------
typedef int LIAPP_STATE;
enum _LIAPP_STATE{LIAPP_STATE_NOCONNECTION,LIAPP_STATE_CONNECTION};
enum _CONNECT_STATE{CONN_IDLE,CONN_WAIT_SEQ2,CONN_WAIT_SEQ4};
enum _BROWSE_STATE{BROWSE_IDLE,BROWSE_WAIT_RSP};
enum _INQ_STATE{INQ_IDLE,INQ_WAIT_RSP};
enum _CONF_STATE{CONF_IDLE,CONF_WAIT_RSP};
enum _FOPEN_STATE{FOPEN_IDLE,FOPEN_WAIT_RSP};
enum _FCLOSE_STATE{FCLOSE_IDLE,FCLOSE_WAIT_RSP};
enum _FWRITE_STATE{FWRITE_IDLE,FWRITE_WAIT_RSP};
enum _FREAD_STATE{FREAD_IDLE,FREAD_WAIT_RSP};
enum _UDEF_STATE{UDEF_IDLE,UDEF_WAIT_RSP};
#ifdef TESTCOMMQ
enum _CQREQ_STATE{CQREQ_IDLE,CQREQ_WAIT_RSP};
#endif
3.1.2. LIAPP Station//-------------------------------------------------------------
// Definition of LIAPP_STATION
//-------------------------------------------------------------
Typedef U16 LIAPP_STATION;
enum _LIAPP_STATION{
LIAPP_STATION_CLIENT,
LIAPP_STATION_SERVER
};
3.1.3. LIAPP Device Node//-------------------------------------------------------------
// Definition of LIAPP_DEVNODE
//-------------------------------------------------------------
Note: This structure is used in Firmware to manage the UID.
typedef struct {
U8 inuse; //y/n
DEVID deviceId;
LIAPP_STATE state;
U8 admin; //used in server mode only, validate user
} DEVNODE;
3.2. Variables 3.2.1. LIAPP General Variables#define ACCESS_LIMIT 1000
#define MAXDEVICE 250 //32
#define MAXBROWSE 250 //100
#define MAXNODES 8 //maxsize of users for one device
#define LANEscapeType 0xAAAA
3.2.2. LIAPP Variables provided by the LIAPP//------------------------------------------------------------------------------
// The below varibles are defined in the document of the LIAPP,
// but some are not implemented in the Liapp.c
//------------------------------------------------------------------------------
Char LIAPP_MyDeviceId[16]; //not defined
Char LIAPP_State; //changed
Char LIAPP_Prestate; //changed
Char LIAPP_RetryLimit;
Char LIAPP_username; //not defined
Char LIAPP_DeviceIdofConnection; //not defined
//------------------------------------------------------------------------------
// The below varibles are found in the Liapp.c
//------------------------------------------------------------------------------
LIAPP_STATE LIAPP_state;
LIAPP_STATE LIAPP_prestate;
U8 LIAPP_mysequence;
U16 LIAPP_maxframesize=1500;
U8 LIAPP_retrylimit=0;
U16 LIAPP_timeout=100;
3.2.3. LIAPP Variables provided by Utility InterfaceMACRO LIAPP_WaitEvent(Event, timeout) //not defined
Event LIAPP_InquiryCompleteEvent //not defined
Event LIAPP_ConfigurationCompleteEvent //not defined
Event LIAPP_StartUploadCompleteEvent //not defined
Event LIAPP_StartDownloadCompleteEvent //not defined
Event LIAPP_UploadCompleteEvent //not defined
Event LIAPP_DownloadCompleteEvent //not defined
Event LIAPP_EndUploadCompleteEvent //not defined
Event LIAPP_EndDownloadCompleteEvent //not defined
3.3. Routines 3.3.1. Support Routines Provided by the LIAPP
//------------------------------------------------------------------------------
// Utility calls routines defined in the document of the LIAPP,
// but some routines are not been implemented in the Liapp.c
//------------------------------------------------------------------------------
STATUS LIAPP_Initialize(char *DeviceId, );
STATUS LIAPP_Indication(char *DeviceId, char *Frame, int Length);
STATUS LIAPP_Browse(char *Manufacturer, char *Product, char *Model, int timeout);
STATUS LIAPP_Inquiry(char *ElementIdList, int timeout);
STATUS LIAPP_Configuration(char *ElementList, int timeout);
//Programmer says that utility calls LIAPP_Config to update information in the Liapp.c, but LIAPP_Update is defined to complete the same function instead of LIAPP_Config.
STATUS LIAPP_StartUpload(void);//not defined
STATUS LIAPP_Upload(char Buffer2Upload, long Bytes2Upload, long timeout);//not defined
STATUS LIAPP_SendEndUpload(void);//not defined
STATUS LIAPP_StartDownload(void);//not defined
STATUS LIAPP_Download(char Buffer2Download, long Bytes2Download, short timeout);//not defined
STATUS LIAPP_SendEndDownload(void);//not defined
STATUS LIAPP_Action(int ActionId, short timeout);//not defined
//---------------------------------------------------------------------------------
// Supporting Inter Routines provided by the LIAPP in the Frams.h
//---------------------------------------------------------------------------------
int mkframe(char *frame,short FrameId,int Sequence,...);
int ValidLIAPPframe(char *frame, int len, LIAPP_HEADER *);
void LIAPP_IndFrames(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
//---------------------------------------------------------------------------------
// Supporting Inter Routines provided by the LIAPP in the Frams.c
//---------------------------------------------------------------------------------
// General Routines for all others
//---------------------------------------------------------------------------------
static void Ind_Connection(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_Disconnection(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
#ifdef _LIAPP_CLIENT_
//--------------------------------------------------------------------------------
// Support as a utility which gets and deals with responses
//--------------------------------------------------------------------------------
static void Ind_FopenRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_ConfigRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_InquiryRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FcloseRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_BrowseRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FreadRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FwriteRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_UDEFRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
#ifdef TESTCOMMQ
static void Ind_GetCQRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
#endif
#else
//-----------------------------------------------------------------------------------
// Support as a server which gets and deals with requests.
//-----------------------------------------------------------------------------------
static void Ind_BrowseReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_InquiryReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_ConfigReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FopenReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FcloseReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FwriteReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FreadReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_UDEFReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
#ifdef TESTCOMMQ
static void Ind_GetCQReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
#endif
#endif
//---------------------------------------------------------------------------------
// Supporting Inter Routines provided by the LIAPP in the LIAPP.h and the LIAPP.c
//---------------------------------------------------------------------------------
char *findeid(char *body,int bodylen,EID eid);
int findelement(char *body,int bodylen,EID eid,char *buf,int buflen);
LIAPP_STATE UserState(unsigned short userId, DEVID *deviceId);
unsigned short AddUser(DEVID *,LIAPP_STATE,unsigned char);
int DelUser(unsigned short userId);
int IsAdmin(unsigned short userId);
unsigned short nextConnection(void);
int ExistConnection(unsigned short userId);
//-------------------------------------------------------------------------------------
// Utility can call following routines provided by the LIAPP in the Liapp.h
//--------------------------------------------------------------------------------------
void LIAPP_ConnectionTimer(void);
LIAPP_STATUS LIAPP_Initialize(int,int,int);
LIAPP_STATUS LIAPP_SetTimeout(int timeout);
int LIAPP_GetTimeout(void);
LIAPP_STATUS LIAPP_Indication(DEVID *,char*,int);
LIAPP_STATUS LIAPP_Browse(ELEMENT*,ELEMENT*,ELEMENT*r,DEVDESC*,int*);
LIAPP_STATUS LIAPP_BrowseMany(int ModelCount,ELEMENT *manu[],ELEMENT *prod[],ELEMENT *model[],DEVDESC*,int*);
LIAPP_STATUS LIAPP_Inquiry(unsigned short,EID*,char*,int);
LIAPP_STATUS LIAPP_Update(unsigned short,ELEMENT*,int);
LIAPP_STATUS LIAPP_Connect(DEVID*,char*,char*,unsigned short*);
LIAPP_STATUS LIAPP_Disconnect(unsigned short);
LIAPP_STATUS LIAPP_Fopen(unsigned short,char*,unsigned char,short*,unsigned long*);
LIAPP_STATUS LIAPP_Fwrite(unsigned short userId,unsigned short fileId,unsigned long byteoffset,char *buf,unsigned long buflen);
LIAPP_STATUS LIAPP_Fread(unsigned short userId,unsigned short fileId,unsigned long byteoffset,char *buf,unsigned long *buflen);
LIAPP_STATUS LIAPP_Fclose(unsigned short userId,unsigned short fileId);
LIAPP_STATUS LIAPP_UserDefine(unsigned short userId,char *buf,int buflen,char** retbuf,int *retlen);
#ifdef TESTCOMMQ
LIAPP_STATUS LIAPP_GetCQReq(unsigned short userId,char *buf,int buflen);
#endif
3.3.2. Support Routines provided by Utility Interface//------------------------------------------------------------------------------------------------------
// Utility calls routines as Utility Interfaces defined in the document of the LIAPP
//------------------------------------------------------------------------------------------------------
TIMERID SetTimer(void * TimeoutCall, int timeout);//not defined
BOOLEAN StopTimer(TIMERID TimerId);//not defined
BOOLEAN LIAPP_Validuser(char *username, char *password);//not defined
BOOLEAN LIAPP_Send(char *DeviceId, char *Frame, int length);//not defined
BOOLEAN LIAPP_Write(char *username, char *destination, char *source, int length);//not defined
BOOLEAN LIAPP_Read(char *username, char *destination, char *source, int length);//not defined
BOOLEAN LIAPP_SetElement(int ElementId, int ElementLength, char *ElementValue);//not defined
BOOLAEN LIAPP_GetElement(int ElementId, int MaxElementLength, char *ElementValue);//not defined
Void LIAPP_NotifyEndUpload(void);//not defined
Void LIAPP_NotifyEndDownload(void);//not defined
3.3.3. Routines Call Relationship//------------------------------------------------------------------------------------------------------
// Routines call relationship from top to down
//------------------------------------------------------------------------------------------------------
l Application calls protocol //APIs are to be enriched
APIs supported by LIAPP: LIAPP_*
l Protocol calls UIF and MIB //steady
UIF is relative to network: UIF_*()
MIB is relative to configuration: QueryMIB() and UpdateMIB()
l UIF calls adapter //steady
Uif_Send() Sends: Write_Packet()
ReceivePkt() Receives: Read_Packet()
l Adapter calls Windis //steady
Write_Packet(): W32N_PacketSend()
Read_Packet(): W32N_PacketRead()
4. Implementation Notes 4.1. Make Frame//------------------------------------------------------------------------------------------------------
// Pay attention to the variables of frame and dest
//------------------------------------------------------------------------------------------------------
int mkframe( char *frame, //the address of the whole frame of the LIAPP
short Sequence,
int FrameId,
...
);
static int cpyshort( char *frame, //the address of the whole frame of the LIAPP
char *dest, //the other field of LIAPP, usually use offset plus frame
short value
)
static int mkchar(char *frame,char **dest,char value); // the same
static int mkshort(char *frame,char **dest,short value);
static int mklong(char *frame,char **dest,long value);
static int mkstr(char *frame,char **dest,char* str);
static int cpychar(char *frame,char *dest,char value);
static int cpyshort(char *frame,char *dest,short value);
//------------------------------------------------------------------------------------------------------
// Following variables of va_* given in the Apdialog.h are very important that
// all the frame bodys are directed by va_list, and frame body fields are gotten by
// function va_arg().
//------------------------------------------------------------------------------------------------------
va_list ap; //ap is the array point;
va_start(ap,FrameId); //ap points to the address of the frame body
va_arg(ap,ELEMENT *) //it’s a key,
va_end(ap); // ap points to (char *)-256)
//------------------------------------------------------------------------------------------------------
// In thr frame of CONNECTION, User Name and Password is packed as elements.
// Why? I think that maybe the length of Name and Password is not measured., so
// programer do it as elements.
// Why not use function mkelement()? Because User Name is not an elemnet type.
//------------------------------------------------------------------------------------------------------
mkelement2(frame,&p,EID_adm_name,strlen(user),user))
mkelement2(frame,&p,EID_adm_passwd,strlen(pwd),pwd))
//-----------------------------------------------------------------------------------------------------
// Line1418 in the Frames.c.
// in the code, I can not find the operation with FCS, but when counting the length
// of the frame, we should plus 2. otherwhere we should do the same.
//------------------------------------------------------------------------------------------------------
if (((int)(p-frame)+len+2) > LIAPP_maxframesize) return 0; //2 is the length of FCS
//-----------------------------------------------------------------------------------------------------
// From line1498 to line 1502 in the Frames.c.
// We find that variable length dose not include the length of FCS, but it does not suit
// for the LIAPP.
//------------------------------------------------------------------------------------------------------
Note: The length of variables is not right now. For detail, see LIAPP
length = (int)(p-frame-5);
cpyshort(frame,(char*)frame+3, length);
FCS = Crc16((unsigned char*)frame+5, length, 0);
cpyshort(frame,(char*)(frame+length+5),FCS);
return (length+5+2); //return frame size, 0 for failure
4.2. Indicate Connection//-----------------------------------------------------------------------------------------------------
// Line 954 in the Frames.c
// Why does connnseq have 4 statuses?
// CONN_WAIT_SEQ2 and CONN_WAIT_SEQ4?
// I think that server and utility can launch the call of connection independently, but
// allways utility does it.
//------------------------------------------------------------------------------------------------------
switch(connseq)
{
switch(connseq)
#ifndef _LIAPP_CLIENT_
case 1:… //Connection
case 4:… //ExistConnection
#endif
case 2:….
case 3:…
default:…
}
4.3. DEVID//-----------------------------------------------------------------------------------------------------
// Line 709 in the LIAPP.c
// DEVID.ID[i] is a char, but we find that XI1000_WLA_NETNO is changed from
// int to char
//------------------------------------------------------------------------------------------------------
typedef struct{
char length;
char ID[16]; //last char implies network interface
} DEVID;
… … …
extern int XI1000_WLA_NETNO;
… … …
devid.ID[15]=XI1000_WLA_NETNO; //XI1000_WLA_NETNO, WLA side to send
4.4. How to Build the MIB MAP 4.5. Element Value//------------------------------------------------------------------------------------------------------------
// From the implementation of APU, we can find that if Element Value is define as an ID, then
// the APU can not explain it.
//------------------------------------------------------------------------------------------------------------
For example:
Change linestrcpy(temp,(char *)&xi1500_data[i].BDEVDESC.name); (line 807, Main.cpp) into linestrcpy(temp,(char *)&xi1500_data[i].BDEVDESC. manufacturer);, then you will find that if you click the browse button, the caption of bitmap will disappear. And also change into strcpy(temp,(char *)"CCC"); the caption will appear too.
Following the flow of the QureyMIB(), we will find that MIB_GenMap[i] points the address of the element that we want to get.
5. LIAPP Enhanced 5.1. APIs 5.1.1. DIR Request and ResponseAPI:
LIAPP_STATUS LIAPP_Dir(…)
Functions Related:
static void Ind_DirReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_DirRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
5.1.2. File Seek Request and ResponseAPI:
LIAPP_STATUS LIAPP_Fseek(…)
Functions Related:
static void Ind_FseekReq(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
static void Ind_FseekRsp(DEVID *,LIAPP_HEADER *,char *body,int bodylen);
5.2. MIB StructureNote:Not fit the application now.See MIBTLV.h
AP_CONFIG
{
0 wla_if_no
1 wla_ifp[MAX_NO_WIFACE]
CFG_uTYPE(0x1001, u_char, channel, ATT_RW)
CFG_aTYPE(0x1002, u_char, 32+1, essid, ATT_RW)
CFG_aTYPE(0x1016, u_char, 60, TxPwr_status, ATT_RW)
CFG_uTYPE(0x1003, u_char, min_basic_rate, ATT_RW)
CFG_uTYPE(0x1004, u_char, max_basic_rate, ATT_RW)
CFG_uTYPE(0x1005, u_char, type, ATT_RW)
CFG_uTYPE(0x1006, u_char, llc_type, ATT_RW)
CFG_uTYPE(0x1007, u_short, rts_threshold, ATT_RW)
CFG_uTYPE(0x1008, u_char, use_wep, ATT_RW)
CFG_uTYPE(0x1009, u_char, wep_key_no, ATT_RW)
CFG_aTYPE(0x100A, u_char, 6, peer_addr, ATT_RW)
CFG_uTYPE(0x100B, u_short, frag_threshold, ATT_RW)
CFG_aTYPE(0x100C, u_char, 32+1, wep_key1, ATT_RW)
CFG_aTYPE(0x100D, u_char, 32+1, wep_key2, ATT_RW)
CFG_aTYPE(0x100E, u_char, 32+1, wep_key3, ATT_RW)
CFG_aTYPE(0x100F, u_char, 32+1, wep_key4, ATT_RW)
CFG_uTYPE(0x1010, u_char, sta_tx_rate, ATT_RW)
CFG_uTYPE(0x1011, u_short, retry_limit, ATT_RW)
CFG_uTYPE(0x1012, u_short, preamble, ATT_RW)
CFG_uTYPE(0x1013, u_short, diversity, ATT_RW)
CFG_uTYPE(0x1014, u_char, basic_rates, ATT_RW)
CFG_uTYPE(0x1015, u_char, supported_rates, ATT_RW)
CFG_uTYPE(0x1017, u_short, MDCControl, ATT_RW)
CFG_aTYPE(0x1018, u_char, 2+1, CountryCode, ATT_RW)
CFG_aTYPE(0x1019, u_char, 1, Environment, ATT_RW)
CFG_uTYPE(0x1020, u_short, TXPowerMax, ATT_RW)
CFG_aTYPE(0x1021, u_char, 6+1,PxPDestAddr, ATT_RW)
2 ip
CFG_uTYPE(0x1101, u_char, boot_type, ATT_RW)
CFG_uTYPE(0x1102, struct in_addr, ipaddr, ATT_RW)
CFG_uTYPE(0x1103, struct in_addr, gateway, ATT_RW)
CFG_uTYPE(0x1104, struct in_addr, mask, ATT_RW)
CFG_uTYPE(0x1105, u_char, boot_mode, ATT_RW)
CFG_uTYPE(0x1106, struct in_addr, ipaddr2, ATT_RW)
CFG_uTYPE(0x1107, struct in_addr, gateway2, ATT_RW)
CFG_uTYPE(0x1108, struct in_addr, mask2, ATT_RW)
CFG_uTYPE(0x1109, u_char, boot_mode2, ATT_RW)
CFG_uTYPE(0x110A, u_char, router_mode, ATT_RW)
CFG_uTYPE(0x110B, u_char, nat_port, ATT_RW)
CFG_aTYPE(0x110D, u_char, NFPISZ*SNFPSZ, snat, ATT_RW)
CFG_uTYPE(0x110E, u_char, network_mode, ATT_RW)
CFG_uTYPE(0x110F, u_char, DGWoI, ATT_RW)
3 route
CFG_aTYPE(0x1801,u_char, MAX_RT_NUM*sizeof(struct in_addr) , smask, ATT_RW)
CFG_aTYPE(0x1802,u_char, MAX_RT_NUM*sizeof(struct in_addr) , gaddr, ATT_RW)
CFG_aTYPE(0x1800,u_char,MAX_RT_NUM*sizeof(struct in_addr) , saddr, ATT_RW)
4 dhcpd
CFG_uTYPE(0x1500, u_char, dhcpd_port, ATT_RW)
CFG_uTYPE(0x1501, struct in_addr, ipstart, ATT_RW)
CFG_uTYPE(0x1502, struct in_addr, ipend, ATT_RW)
CFG_uTYPE(0x1503, u_char, dhcp_mask_auto, ATT_RW)
CFG_uTYPE(0x1504, struct in_addr, dhcp_mask, ATT_RW)
CFG_uTYPE(0x1505, u_char, dhcp_gateway_auto, ATT_RW)
CFG_uTYPE(0x1506, struct in_addr, dhcp_gateway, ATT_RW)
CFG_uTYPE(0x1507, u_char, dhcp_dns1_auto, ATT_RW)
CFG_uTYPE(0x1508, struct in_addr, dhcp_dns1, ATT_RW)
CFG_uTYPE(0x1509, u_char, dhcp_dns2_auto, ATT_RW)
CFG_uTYPE(0x150A, struct in_addr, dhcp_dns2, ATT_RW)
CFG_uTYPE(0x150B, u_char, dhcp_wins1_auto, ATT_RW)
CFG_uTYPE(0x150C, struct in_addr, dhcp_wins1, ATT_RW)
CFG_uTYPE(0x150D, u_char, dhcp_wins2_auto, ATT_RW)
CFG_uTYPE(0x150E, struct in_addr, dhcp_wins2, ATT_RW)
// Kevin 010702: add persistent DNS/WINS settings in DHCP wizard
CFG_uTYPE(0x150F, struct in_addr, dhcp_dns1_save, ATT_RW)
CFG_uTYPE(0x1510, struct in_addr, dhcp_dns2_save, ATT_RW)
CFG_uTYPE(0x1511, struct in_addr, dhcp_wins1_save, ATT_RW)
CFG_uTYPE(0x1512, struct in_addr, dhcp_wins2_save, ATT_RW)
5 snmp
CFG_aTYPE(0x1401, u_char, 127+1, sys_contact, ATT_RW)
CFG_aTYPE(0x1402, u_char, 127+1, sys_descr, ATT_RW)
CFG_aTYPE(0x1403, u_char, 127+1, sys_location, ATT_RW)
CFG_uTYPE(0x1404, struct in_addr, manager1_ipaddr, ATT_RW)
CFG_aTYPE(0x1405, u_char, 32+1, community, ATT_RW)
CFG_uTYPE(0x1406, struct in_addr, manager2_ipaddr, ATT_RW)
6 mgmt
CFG_aTYPE(0x1201, u_char, 32+1, adm_passwd, ATT_RW)
CFG_aTYPE(0x1202, u_char, 32+1, apname, ATT_RW)
CFG_aTYPE(0x1203, u_char, 32+1, adm_name, ATT_RO)
CFG_uTYPE(0x1204, u_short, http_port, ATT_RW)
CFG_uTYPE(0x1205, u_short, telnet_port, ATT_RW)
CFG_aTYPE(0x1206, u_char, 12+1, root_passwd, ATT_RW)
7 var
CFG_uTYPE(0x1301, u_short, acktime, ATT_RW)
//CFG_uTYPE(0x1302, u_short, xi1000mode, ATT_RW)
CFG_uTYPE(0x1303, u_short, echosvr, ATT_RW)
CFG_uTYPE(0x1304, u_short, always_dhcps, ATT_RW)
CFG_uTYPE(0x1305, u_char, lan_speed, ATT_RW)
CFG_uTYPE(0x1306, u_char, wla_reset, ATT_RW)
CFG_uTYPE(0x1307, u_short, time_wlareset, ATT_RW)
CFG_uTYPE(0x1308, u_short, time_wakeup, ATT_RW)
CFG_uTYPE(0x1309, u_short, wla_cardtype, ATT_RW)
CFG_uTYPE(0x1309, u_char, wla_cardtype, ATT_RW)
CFG_uTYPE(0x1310, u_short, time_stadisasso, ATT_RW)
CFG_uTYPE(0x1311, u_short, wla_typechange, ATT_RW)
CFG_uTYPE(0x1312, u_short, telnet_timeout, ATT_RW)
CFG_uTYPE(0x1313, u_char, wla_stacommblock, ATT_RW)
CFG_uTYPE(0x1314, u_char, Hidden_AP, ATT_RW)
8 access
CFG_uTYPE(0x1600, u_char, enable_access_ctrl, ATT_RW)
9 pppoe
CFG_uTYPE(0x1700, u_char, enable_pppoe, ATT_RW)
CFG_aTYPE(0x1701, u_char, 32+1, pppoe_user, ATT_RW)
CFG_aTYPE(0x1702, u_char, 32+1, pppoe_passwd, ATT_RW)
CFG_uTYPE(0x1703, u_char, pppoe_cm, ATT_RW)
CFG_uTYPE(0x1704, u_short, pppoe_cm_idle, ATT_RW)
CFG_aTYPE(0x1705, u_char, 127+1, pppoe_user_long, ATT_RW)
10 radius
CFG_uTYPE(0x2100, u_char, enable_user_auth_ctrl, ATT_RW)
CFG_uTYPE(0x2101, u_char, enable_account_ctrl, ATT_RW)
CFG_uTYPE(0x2102, struct in_addr, auth_ipaddr, ATT_RW)
CFG_uTYPE(0x2103, u_short, auth_port, ATT_RW)
CFG_aTYPE(0x2104, u_char,16+1,auth_secret, ATT_RW)
CFG_uTYPE(0x2105, u_short, reauth_period, ATT_RW)
CFG_uTYPE(0x2106, struct in_addr, account_ipaddr, ATT_RW)
CFG_uTYPE(0x2107, u_short, account_port, ATT_RW)
CFG_aTYPE(0x2108, u_char,16+1,account_secret, ATT_RW)
CFG_uTYPE(0x2109, u_long,sessionid_h, ATT_RW)
11 throughputctl
CFG_uTYPE(0x2301, u_long,allclient_up, ATT_RW)
CFG_uTYPE(0x2302, u_long,allclient_down, ATT_RW)
CFG_uTYPE(0x2303, u_long,allclient_total, ATT_RW)
}
5.3. EID Display//----------------------------------------------------------------------------------------------------------------
// AP System Configuration Object
//----------------------------------------------------------------------------------------------------------------
#define U8 unsigned char //1 byte
#define U16 unsigned short //2 bytes
#define U32 unsigned long //4 bytes
#define ATT_NA 0 //not used
#define ATT_RO 1 //read only
#define ATT_WO 2 //write only
#define ATT_RW 3 //full access
#define TLV_CTRL(id, vname, scale, att) {id, sizeof(mibAP##.##vname), (uint8*)&(mibAP##.##vname), scale, att}
#define END_TAG 0xffff
#define END_TLV { END_TAG, 0, 0, FALSE,ATT_NA}
// TLV struct define
typedef struct _mib_tlv_ctrl
{
uint16 tag; // global unique ID for this variable
uint8 size; // size (in byte) of this variable
uint8 *ptr; // offset in the struct which contains this variable
Boolean scale; // scale type or byte stream
uint8 attr;
} mib_tlv_ctrl;
// MIB TLV array define
//mib_AP_t *pMibAp =
static mib_tlv_ctrl mib_tlv[] =
{
//-----------------------------------------------------------------------------------------------------------
// Following is defined to fit the XG580PLUS by Mitch
// Main structure is similar as the Web UI
//
// #define U8 unsigned char //1 byte
// #define U16 unsigned short //2 bytes
// #define U32 unsigned long //4 bytes
//
// Format:TLV_CTRL(id,vname,scale,att)
//
//TLV_CTRL( id, vname, scale, att ) //Type Length Description
//-----------------------------------------------------------------------------------------------------------
//browse
TLV_CTRL( EID_manufacturer_id,manufacturer_id, FALSE, ATT_RO),//u8 40
TLV_CTRL( EID_product_id, product_id, FALSE, ATT_RO), //u8 20
TLV_CTRL( EID_model_id, model_id, FALSE, ATT_RO), //u8 20
TLV_CTRL( EID_devName, devName, false, ATT_RW), //u8 20
TLV_CTRL( EID_detail_id, detail_id, FALSE, ATT_RO), //u8 100
//Common
TLV_CTRL( EID_username, username, FALSE, ATT_RO), //u8 20
TLV_CTRL( EID_password, password, TRUE, ATT_RW), //u8 20
//Information
//Information -> General
TLV_CTRL( EID_EthMacAddr, EthMacAddr, false, ATT_RO), //u8 6
/*
TLV_CTRL( EID_FWMajor, FWMajor, true, ATT_RO), //u16 1 FW:Fireware
TLV_CTRL( EID_FWMiddle, FWMiddle, true, ATT_RO), //u16 1
TLV_CTRL( EID_FWMinor, FWMinor, true, ATT_RO), //u16 1
*/
TLV_CTRL( EID_Version, Version, false, ATT_RO), //u8 40 //for the future
/*
TLV_CTRL( EID_WebMajor, WebMajor, true, ATT_RO), //u16 1
TLV_CTRL( EID_WebMiddle, WebMiddle, true, ATT_RO), //u16 1
TLV_CTRL( EID_WebMinor, WebMinor, true, ATT_RO), //u16 1
*/
TLV_CTRL( EID_WebVersion, WebVersion, false, ATT_RO), //u8 40 //for the future
//Configuration
//Configuration -> General
TLV_CTRL( EID_devName, devName, false, ATT_RW), //u8 20
TLV_CTRL( EID_WirelessMode,WirelessMode, true, ATT_RW), //u16 1
TLV_CTRL( EID_NetworkType,NetworkType, true, ATT_RW), //u16 1
TLV_CTRL( EID_DesiredSsId,DesiredSsId, false, ATT_RW), //u8 20
TLV_CTRL( EID_CurrRFChan, CurrRFChan, false, ATT_RW), //u16 1 Current RF Channel
TLV_CTRL( EID_apMode, apMode, false, ATT_RW), //u16 1 1.B only mode 2.G only mode 3.B/G Mixed Mode
TLV_CTRL( EID_TxRate, TxRate, true, ATT_RW), //u16 1 1.Auto 2.1 2 5.5….54
TLV_CTRL( EID_countrycode,countrycode, true, ATT_RW), //u16 1
//Configuration -> Security
TLV_CTRL( EID_WEPMode, WEPMode, true, ATT_RW), //U16 1
TLV_CTRL( EID_AuthType, AuthType, true, ATT_RW), //u16 1 Auth:Authentication
TLV_CTRL( EID_WpaPsk, WpaPsk, false, ATT_RW), //u8 20
TLV_CTRL( EID_askey, askey, true, ATT_RW), //u16 1 Key Format: 1.ASCII 2.HEX
// TLV_CTRL( EID_Passphrase, Passphrase, false, ATT_RW), //u8 20
TLV_CTRL( EID_WepDefaultKeyValue1,\
WepDefaultKeyValue1, false, ATT_RW),//u8 20
TLV_CTRL( EID_WepDefaultKeyValue2,\
WepDefaultKeyValue2, false, ATT_RW),//u8 20
TLV_CTRL( EID_WepDefaultKeyValue3,\
WepDefaultKeyValue3, false, ATT_RW),//u8 20
TLV_CTRL( EID_WepDefaultKeyValue4,\
WepDefaultKeyValue4, false, ATT_RW),//u8 20
//Configuration -> Access Control
TLV_CTRL( EID_macCloneEnable,macCloneEnable, true, ATT_RW),//u16 1
TLV_CTRL( EID_wlanfiltermode,wlanfiltermode, false, ATT_RW),//u16 1 AC:Access Control
//Configuration -> Parameter Log
//TCP/IP
//TCP/IP -> General
TLV_CTRL( EID_EnableDHCP, EnableDHCP, true, ATT_RW), //u16 1
TLV_CTRL( EID_IPAddr, IPAddr, false, ATT_RW), //u8 4
TLV_CTRL( EID_SubnetMask, SubnetMask, false, ATT_RW), //u8 4
TLV_CTRL( EID_GwyAddr, GwyAddr, false, ATT_RW), //u8 4 Gwy:Gateway
//Statistics
//Statistics -> Status
//Statistics -> Statistics
TLV_CTRL( EID_EthInPkt, EthInPkt, true, ATT_RW), //u32 1 Ethernet In Packet
TLV_CTRL( EID_EthOutPkt, EthOutPkt, true, ATT_RW), //u32 1 Ethernet Out Packet
//Statistics -> AP Browser
END_TLV
};
本文地址:http://com.8s8s.com/it/it34108.htm