My FAQ,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 未整理篇
LIAPPFrameDefinitionandImplementation
作者:iWildWood 时间:2003-02-14 11:09 出处:互联网 责编:MyFAQ
              摘要:LIAPPFrameDefinitionandImplementation

 

 

 

 

 

 

 

 

 

 

 

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 Format

Note: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 Definition

Note: 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 Structure

Note: 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 Definition

Note: 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 Format

Typedef 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 Format

Note: 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 Format

Typedef struct{

       U16 INQ_userId;                        //user ID

       DEVID INQ_deviceId;                 //device Id

}LIAPP_FB_INQREQ;

2.3.2.4.            Inquiry Response Frame Format

Typedef 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 Format

Typedef struct{

       U16 CONF_userId;                            //user ID

       DEVID CONF_deviceId;              //device Id

}LIAPP_FB_CONFREQ;

2.3.2.6.            Configuration Response Frame Format

Typedef struct{

U16 CONF_userId;                            //user ID

U16 CONF_state;                        //status code

}LIAPP_FB_CONFRSP;

2.3.2.7.            Connection Frame Format

Typedef 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

<