#if !defined(AFX__COMMON_H__7CB6FC5C_6968_449E_B2B5_045AADB07B1A__INCLUDED_) #define AFX__COMMON_H__7CB6FC5C_6968_449E_B2B5_045AADB07B1A__INCLUDED_ # if defined(IPADMINDLL_EXPORTS) # define IPADMIN_API __declspec(dllexport) # else # define IPADMIN_API __declspec(dllimport) # endif #define WM_ADDCLIENT WM_USER+1 #define WM_DELETECLIENT WM_USER+2 #define WM_INFORMATION WM_USER+3 //#define WM_PROGRESS WM_USER+4 //#define WM_ADMIN_SEND_FILE WM_USER+4 //Init... #define NET5_ADMIN_REBOOT 0x01 // #define NET5_ADMIN_REFRESH 0x02 // #define NET5_ADMIN_INIT 0x03 // #define NET5_ADMIN_CLOSE 0x04 // //IP Config #define NET5_ADMIN_IPSETUP 0x10 //LPCTSTR pIp, LPCTSTR pData, ULONG *pLen #define NET5_ADMIN_NETMASK 0x11 //LPCTSTR pIp, LPCTSTR pData, ULONG *pLen #define NET5_ADMIN_GATEWAY 0x12 //LPCTSTR pIp, LPCTSTR pData, ULONG *pLen #define NET5_ADMIN_DNS 0x13 //LPCTSTR pIp, LPCTSTR pData, ULONG *pLen #define NET5_ADMIN_DHCP 0x15 //LPCTSTR pIp //Get Info #define NET5_ADMIN_GETINFO 0x20 //ULONG *pIndex, [out]ULONG *pClientInfo //Nvram Config #define NET5_ADMIN_NICNAME 0x30 //LPCTSTR pIp, LPCTSTR pData, ULONG *pLen //Firmware Update #define NET5_ADMIN_FIRMWARE 0x50 //LPCTSTR pIp, LPCTSTR sFilePath #define NET5_ADMIN_BOOTLOAD 0x51 //LPCTSTR pIp, LPCTSTR sFilePath #define MAXCLIENT 1024 typedef struct { bool isFlag; // empty(false), true(using) bool info; // Does get tcp information? int UDPErrorCnt; // for check dead device int TCPErrorCnt; // for don't try to get information if it's invalid device char FirmwareVersion[64]; char RTSP[64]; char HTTP[64]; char Name[64]; char sIp[64]; char Subnet[64]; char Gate[64]; char Dns[64]; char MAC[64]; char SerialNo[64]; char NickName[64]; char Server[64]; char wwwroot[64]; char ubootver[64]; char dhcp; // y - dhcp, n - static } Clientinfo; typedef void(Func)(Clientinfo); // ´ÙÁß ¾÷µ¥ÀÌÆ®½Ã ±¸ºÐÀ» À§ÇØ ipÃß°¡ typedef void(UpgradeCallback)(const char* ip, int cur, int total); // below struct is the protocol for comunicate with the server typedef struct { char Subnet[64]; char Gate[64]; char Dns[64]; char Server[64]; char RTSP[64]; char HTTP[64]; char Name[64]; char SerialNo[64]; char NickName[64]; char Firmware[64]; char wwwroot[64]; char ubootver[64]; char dhcp; // 'y' - dhcp, 'n' - static } Information; extern "C" { //////////////////////////////////////////////////////////////////////////////// // Init func & //////////////////////////////////////////////////////////////////////////////// //extern "C" __declspec(dllexport) BOOL Net5AdminCommand(ULONG uAdminCmd, ULONG *pParam1, ULONG *pParam2, ULONG *pParam3); // return : true if success, false if fail BOOL IPADMIN_API InitSocket(HWND _hwnd); // return : >0 - success, <= 0 - fail // -1 : tcp socket bind error // -2 : setsockopt error for add membership int IPADMIN_API InitSocket2(HWND _hwnd); BOOL IPADMIN_API CloseDll(); BOOL IPADMIN_API Refresh(); // this is for notify adding or deleting client information void IPADMIN_API SetCallback(Func pfun); // get device client information void IPADMIN_API SearchDevice(Clientinfo & send, int index); //////////////////////////////////////////////////////////////////////////////// // Ctrl func & //////////////////////////////////////////////////////////////////////////////// // act // ** 0 ~ 0x20 : support to use udp packet when send command(always success) // 0x01 - reboot // 0x10 - change ip // 0x11 - change subnet mask // 0x12 - change gateway // 0x13 - change dns // 0x14 - change dhcp mode // 0x30 - change host name ** don't support after kernel 5XX BOOL IPADMIN_API CtrlDevice(char * ip, int act, unsigned char * data, int len); // pw_hash = hash(id+pw+mac) // -1041: broken packet received // -1042: access level lowwer than request operation // -1043: not match pw // -1061: not exists user id // -167: it's need login process int IPADMIN_API CtrlDeviceEx( char* ip, char* id, char* pw_hash, int act, unsigned char * data, int len); // get act information from device // act : information type // data : input data and output buffer // len : input data size // max : buffer size to use data when is output buffer // // return value - - // < 0 : fail(other value means success) // >= 0 : response data size(it store in data) int IPADMIN_API GetDeviceInfo2(char* ip, BYTE* info, int len, BYTE* pOut, int* nOut, int max); // does not uses but exists only for compatibly int IPADMIN_API GetDeviceInfo(char* ip, BYTE* info, int len, BYTE* pOut, int* nOut, int max); /* // get rack/blade id using rtsp command // return value : // 1 - success // -1 - fail // 0 - it isn't blade card extern "C" __declspec(dllexport) int GetRackID(char* ip, int* rack, int* blade); */ //////////////////////////////////////////////////////////////////////////////// // File Data //////////////////////////////////////////////////////////////////////////////// // flag // 0x40 - OCX upload // 0x50 - kernel upload // 0x60 - boot loader upload // 0x70 - web upload // 0x80 - emergency kernel upload // // return // > 0 : success // -1 : socket open error // < -10 - filesend() fails // -11 : don't exists indicate filename // -12 : can't send header packet // -13 : can't read file data // -14 : can't send data to socket - loginÇÏÁö ¾ÊÀº °æ¿ì // -15 : does't response from device(socket) // -16 : device response was fail(0x00) // -17 : device response was fail(0xff) - Æß¿þ¾î ¾÷µ¥ÀÌÆ®ÇÏ°í ÀçºÎÆà ¾øÀÌ ´Ù½Ã ¾÷µ¥ÀÌÆ®ÇÏ´Â °æ¿ì. // < -20 - FileBackup() ÇÔ¼ö ¿À·ù // login error list // -1041: broken packet received // -1042: access level low than request operation // -1043: not match pw // -1061: not exists user id int IPADMIN_API UpGrade(const char *ip, const char *file, int flag); // pw_hash = md5_hash(id+pw+mac) int IPADMIN_API UpGradeEx( const char *ip, const char* id, const char* pw_hash, const char *file, int flag); void IPADMIN_API SetUpgradeCallback(UpgradeCallback pfun); // run updating with result log message // type : 0x51 - dome update // file : // return // < 0 : error // > 0 : success //extern "C" __declspec(dllexport) int UpdateWithLog(const char *ip, const char *file, int type, char* log, int max); // for user file upload. - was not use in protect model BOOL IPADMIN_API SingleFileUpdate(char *ip, char *filepath, char *filename, char *savepath, int flag); //extern "C" __declspec(dllexport) BOOL InitUpdateHandle(HWND hwnd); // for SingleFileUpdate(); // return value : // 1 : success // 2 : already exists same ip // -1 : don't exists empty slot // -2 : can't connect ip(or timeout) int IPADMIN_API AddManualIP(const char* ip); BOOL IPADMIN_API GetDeviceInformation(char * ip, Information* infop, int timeout_ms); } // extern "C" #endif // !defined(AFX_COMMON_H__5B1114A6_5073_46DC_95C5_B334C3E3715B__INCLUDED_)