//////////////////////////////////////////////////
//Title    : pub_inet.h
//Auhtor   : Liu Wei
//Desc     : public inet function header
//Created  : 2007-06-22
//Revision :
//
//Revision :
//
//////////////////////////////////////////////////

#ifndef _PUB_INET_H_
#define _PUB_INET_H_

#include "public.h"
#include "includes.h"
#include "pub_debug.h"

///////////////////////////////////////////////////////////////////////////
//   Inet If Address infomation interface                                                                 
///////////////////////////////////////////////////////////////////////////

#define MAXINTERFACES 16

typedef struct IF_ADDR
{
    u8  uIfNum;
    struct 
    {
    	u32 dIfIP;
        u8  uIfState;
    }  
    tIfEntity[MAXINTERFACES];
}
IfAddr;

extern int GetNetIfInfo ( IfAddr * pIfAddr );

extern u32 GetLocalIP();

///////////////////////////////////////////////////////////////////////////
//  Ping Interface                                                                  
///////////////////////////////////////////////////////////////////////////

#define PACKET_SIZE     4096
#define MAX_NO_PACKETS  3

typedef void PingCallBack( int nPingResult );

typedef struct ICMP_SERVICE
{
	u8    uSrvState;
	u8    uIcmpState;
	u8    uPackNo;
	u8    uDataLen; 
	u8    nPackNumSend;
	u8    nPackNumRecv;
	u8    aSendBuff[PACKET_SIZE];
    u8    aRecvBuff[PACKET_SIZE];
    u32   wSockfd;
    pid_t tPid;
    struct sockaddr_in tToAddr;
    struct sockaddr_in tFromAddr;
    struct protoent *pProtoent;
    PingCallBack *fCallBack;
}
IcmpSrv;

extern int PingInit ( IcmpSrv *pIS , int nDataLen );

extern int PingStart( IcmpSrv *pIS , char *sIP , PingCallBack fCallBack );

extern int PingTimer ( IcmpSrv *pIS );

DWORD	GetLocalIP();
DWORD	wxc2_get_shm_offset();
#endif
