daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2012 385 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef __ENET_AGENTD_H__
  2. #define __ENET_AGENTD_H__
  3.  
  4. #ifdef ENET_SUPPORT_AGENTD
  5.  
  6. #include "enet/enet_function.h"
  7.  
  8. __BEGIN_C_PROTO__
  9.  
  10. #define dbg(format, arg...)    fprintf(stderr, "DEBUG: " __FILE__" line %d: " format "\n", __LINE__, ## arg)
  11.  
  12. #ifndef ENET_AGENTD_PORT
  13. #define ENET_AGENTD_PORT 13364
  14. #endif
  15.                                                                                                    
  16. #define RESET                   0x01    // ���}�
  17. #define READ_SETTING            0x02    // Ū�� Camera �� information�A�ϥ� _IC_SETTING
  18. #define SET_CONFIG              0x03    // �]�w Camera�A�ϥ� _IC_CONFIG
  19. #define SEARCH_IPCAM            0x04    // �j�M Camera�A�� broadcast �^�A�ϥ� _IC_NAME
  20. #define SEARCH_MANUAL           0x05    // �j�M Camera�A�Ψӷ� ip �^
  21. #define READ_SETTING_MANUAL     0x06    // Ū�� Camera �� information�A�Ψӷ� ip �^
  22. #define FIRMWARE_UPGRADE        0x07    // �i�J upgrade mode (for IC-1000 only)
  23. #define FACTORY_DEFAULT         0x08    // reset to default
  24. #define GETWLAN_COMMAND         0x09    // ���o wireless lan �����T�A�ϥ�_WLANINFO
  25. #define SITESURVEY_COMMAND      0x0A    // ���o sitesurvey ���G�A�ϥ� _SITESURVEY
  26. #define LED_ON_OFF_COMMAND                      0x0B
  27. #define GETWLAN_COMMAND_MANUAL          0x0C // ���o wireless lan �����T�A�ϥ�_WLANINFO�A�Ψӷ� ip �^
  28. #define SITESURVEY_COMMAND_MANUAL       0x0D // ���o sitesurvey ���G�A�ϥ� _SITESURVEY�A�Ψӷ� ip �^
  29. #define LED_ON_OFF_COMMAND_MANUAL       0x0E // �Ψӷ� ip �^
  30. #define READ_EMAIL_AUTH                         0x10
  31. #define SET_EMAIL_AUTH                          0x11
  32. #define GET_USERS                   0x12
  33. #define SET_USERS                   0x13
  34. #define SEND_TEST_EMAIL             0x14
  35. #define READ_FTP_SETTING            0x15
  36. #define SET_FTP_SETTING             0x16
  37. #define READ_TIME_SETTING           0x17
  38. #define SET_TIME_SETTING            0x18
  39. #define READ_PPPOE_SETTING                      0x19
  40. #define SET_PPPOE_SETTING                       0x1A
  41.                                                                                                    
  42. #define READ_EMAIL_AUTH_MANUAL      0x1D
  43. #define GET_USERS_MANUAL            0x1E
  44. #define READ_FTP_SETTING_MANUAL     0x1F
  45. #define READ_TIME_SETTING_MANUAL    0x20
  46. #define READ_PPPOE_SETTING_MANUAL   0x21
  47.  
  48. #define MAC_ID_LEN              6
  49. #define REQUEST_LEN             4
  50. #define MAX_SIZE                5120
  51.                            
  52. /*                                                                        
  53. typedef struct search_s{
  54.         unsigned char mac[MAC_ID_LEN];
  55.         unsigned edicfg[REQUEST_LEN];
  56. } __ATTRIB_PACK__ search_t;
  57. */
  58.  
  59. typedef struct enet_agentd_s
  60. {
  61.         bool    running;
  62.         pthread_t thread;
  63. }enet_agentd_t;
  64.  
  65. /* neo: copy from MainPage.cpp */
  66. typedef struct TCPConfigPacket
  67. {
  68.         unsigned char NodeID[6]; // MAC id�A�ΨӤ����O�_�O���ۤv�� command�A���F search �ʥ]�~�A���l���ʥ]���n�ŦX mac id �~process
  69.         unsigned char edicfg[4]; // [0]: 0 request, 1 response,  [1]: command,  [2]: ff, [3]: ff-command
  70. }__ATTRIB_PACK__ TCPCFG;
  71.  
  72. enum FuncTypes{
  73.         REQUEST,
  74.         RESPONSE,
  75.         FAULT,
  76. };
  77.  
  78. /*
  79. model definition (IC_DeviceModel):
  80.     0x1, 0x2: IC1000, IC1000WG
  81.     0x3, 0x4: IC3000, IC3000WG
  82.     0x5, 0x6: IC1001, IC1001WG
  83.     0x7, 0x8: IC1500, IC1500WG
  84. */
  85.  
  86. typedef struct _IC_NAME
  87. {
  88.     unsigned char IC_Name[32];
  89.     unsigned char IC_IP[4];
  90.     unsigned char IC_Reserved0[20];
  91.     unsigned char IC_VendorID;
  92.     unsigned char IC_SubVendorID;
  93.     unsigned char IC_DeviceType;        // 0x05 for IPCamera
  94.     unsigned char IC_DeviceModel;
  95.         unsigned char IC_Setted;
  96.         unsigned char IC_Reserved1[5];
  97. } __ATTRIB_PACK__ IC_NAME, *PIC_NAME;
  98.  
  99. typedef struct _IC_MD_1500
  100. {
  101.         char    IC_MD_enable;                /* Enable */
  102.         char    IC_MD_email;                 /* Send email alert? */
  103.         char    IC_MD_ftp;                   /* Upload to FTP server? */
  104.         char    IC_MD_title[MAX_TITLE_LEN];  /* Clip title */
  105.         u16             IC_MD_threshold;             /* Threshold */
  106.         u16             IC_MD_delay;                 /* Delay time after event */      
  107. }__ATTRIB_PACK__ IC_MD_1500, *PIC_MD_1500;
  108.  
  109. typedef struct _IC_MD_3010
  110. {
  111.         char    IC_MD_enable;                /* Enable */
  112.         char    IC_MD_email;                 /* Send email alert? */
  113.         char    IC_MD_ftp;                   /* Upload to FTP server? */
  114.         char    IC_MD_title[MAX_TITLE_LEN];  /* Clip title */
  115.         u32             IC_MD_length;                /* length */
  116.         u32             IC_MD_delay;                 /* Delay time after event */      
  117. }__ATTRIB_PACK__ IC_MD_3010, *PIC_MD_3010;
  118.  
  119. typedef struct _IC_SETTING
  120. {
  121.         unsigned char email[32];
  122.  
  123.     unsigned char emailserver[32];
  124.         unsigned char IC_SUBNET[4];
  125.         unsigned char IC_GATEWAY[4];
  126.         unsigned char IC_DNS[4];
  127.         unsigned short IC_PORT;
  128.         unsigned short IC_WEB_PORT;
  129.     unsigned char IC_Resolution;
  130.     unsigned char IC_FirmwareVer[5];
  131.         unsigned char IC_Password[5];   //for IC1000, IC1001 only
  132.         unsigned char IC_DDNS_DOMAIN[0x21];
  133.         unsigned char IC_DDNS_ACCOUNT[0x11];
  134.         unsigned char IC_DDNS_PASSWORD[0x11];
  135.         unsigned char IC_DDNS_ENABLE;
  136.         unsigned char IC_UPNP_ENABLE;
  137.         unsigned char IC_Name[32];
  138.         unsigned char IC_DHCP_ENABLE;
  139.         unsigned char IC_PPPOE_ENABLE;
  140.         /* for IC1001 */
  141.         unsigned char IC_DDNS_SERVER_ID; // 0:dyndns, 1:TZO
  142.         unsigned char IC_TZO_DDNS_ACCOUNT[48];
  143.         unsigned char IC_TZO_DDNS_PASSWORD[48];
  144.         unsigned char IC1001_EMAIL_SENDER[32];
  145.         /* for IC1001 end */
  146.         unsigned char IC_LongPassword[MAX_PASSWD_LEN];  //for IC1500
  147.        
  148. #if defined AGENTED_SUPPORT_MD
  149.         IC_MD_1500 m_IC_MD_1500;
  150.         IC_MD_3010 m_IC_MD_3010;
  151. #endif
  152.  
  153. } __ATTRIB_PACK__ IC_SETTING, *PIC_SETTING;
  154.  
  155. typedef struct _WLANINFO
  156. {
  157.      char SSID[33];      // MAX 32 Bytes
  158.      char BSSID[18];     // 00:11:22:33:44:55
  159.      char  Channel;      //
  160.      char  Network_Type;    // 0:Disable 1:Ad Hoc 2:Infrastructure
  161.      char  Encryption;     // // 0:Disable, 1:64bits, 2:128bits, 3: TKIP, 4: AES
  162.      char  Key_Format;     // 0 : ASCII, 1: HEX
  163.      char  Default_Key;    //0:Key1 1:Key2 2:Key3 3:Key4
  164.      char Key[4][26];
  165.      char Connected;
  166.          char auth_mode;            // 0: none, 1: open, 2: share, 3:WPA
  167.      char WPA_KEY[65];       // WPA-KEY MAX 64Bytes;
  168. }__ATTRIB_PACK__ WLANINFO, *PWLANINFO;
  169.  
  170. typedef struct _IC_CONFIG
  171. {
  172.         TCPCFG cfg;
  173.     unsigned char IC_Name[32];
  174.         unsigned char IC_IP[4];
  175.         unsigned char IC_SUBNET[4];
  176.         unsigned char IC_GATEWAY[4];
  177.         unsigned char IC_DNS[4];
  178.         unsigned short IC_PORT;
  179.         unsigned short IC_WEB_PORT;
  180.  
  181.                 unsigned char IC_email[32];
  182.  
  183.     unsigned char IC_emailserver[32];
  184.     unsigned char IC_Resolution;
  185.         unsigned char IC_Password[5]; //for IC1000, IC1001 only
  186.         unsigned char IC_DDNS_DOMAIN[0x21];
  187.         unsigned char IC_DDNS_ACCOUNT[0x11];
  188.         unsigned char IC_DDNS_PASSWORD[0x11];
  189.         unsigned char IC_DDNS_ENABLE;
  190.         unsigned char IC_UPNP_ENABLE;
  191.         unsigned char IC_DHCP_ENABLE;
  192.         unsigned char IC_PPPOE_ENABLE;
  193.     WLANINFO wlaninfo;
  194.     unsigned char IC_Reserved;
  195.         /* for IC1001 */
  196.         unsigned char IC_DDNS_SERVER_ID; // 0:dyndns, 1:TZO
  197.         unsigned char IC_TZO_DDNS_ACCOUNT[48];
  198.         unsigned char IC_TZO_DDNS_PASSWORD[48];
  199.         unsigned char IC1001_EMAIL_SENDER[32];
  200.         /* for IC1001 end */
  201.         unsigned char IC_LongPassword[MAX_PASSWD_LEN];  //for IC1500
  202.        
  203. #if defined AGENTED_SUPPORT_MD
  204.         IC_MD_1500 m_IC_MD_1500;
  205.         IC_MD_3010 m_IC_MD_3010;
  206. #endif
  207.        
  208. } __ATTRIB_PACK__ IC_CONFIG, *PIC_CONFIG;
  209.  
  210.  
  211.  
  212. typedef struct _SITESURVEY
  213. {
  214.      char SSID[33];      // MAX 32 Bytes
  215.      char BSSID[18];     // 00:11:22:33:44:55
  216.      char Channel;      //
  217.      char Network_Type;    // 1:Ad Hoc 2:Infrastructure
  218.      char Encryption;     // 0:Disable 1:64 2:128 3:TKIP 4:AES
  219.      char Rssi;                //signal quality
  220. } __ATTRIB_PACK__ SITESURVEY, *PITESURVEY;
  221.  
  222. typedef struct _IC_LED
  223. {
  224.         TCPCFG cfg;
  225.         char IC_LED;
  226. } __ATTRIB_PACK__ IC_LED, *PIC_LED;
  227.  
  228.  
  229. typedef struct _EMAIL_AUTH
  230. {
  231.         char emailauth;
  232.         char emailaccount[32];
  233.         char emailpassword[32];
  234.         char emailsender[32];
  235. } __ATTRIB_PACK__ EMAIL_AUTH;
  236.  
  237. typedef struct _TEST_EMAIL
  238. {
  239.         TCPCFG header;
  240.                 char   email_receive[32];
  241.         char   email_server[32];
  242.         char   email_sender[32];
  243.         char   email_auth;
  244.         char   email_account[32];
  245.         char   email_password[32];
  246. }__ATTRIB_PACK__ TEST_EMAIL, *PTEST_EMAIL;
  247.  
  248. typedef struct _FTP_SETTING
  249. {
  250.         TCPCFG     header;
  251.     char   Server[64];
  252.     unsigned int Port;
  253.     char   UserName[32];
  254.     char   Password[32];
  255.     char   Folder[128];
  256.     char   Passive;
  257. }__ATTRIB_PACK__ FTP_SETTING, *PFTP_SETTING;
  258.  
  259. typedef struct _PPPOE_SETTING
  260. {
  261.         TCPCFG  header;
  262.         char    UserName[64];
  263.         char    Password[64];
  264.         int             MTU;
  265. }__ATTRIB_PACK__ PPPOE_SETTING, *PPPPOE_SETTING;
  266.  
  267.  
  268. typedef struct _USERS
  269. {
  270.         TCPCFG  header;
  271.         char    check;  // bit1 set to 1 means User1 is enabled, bit2  for User2, bit3 for User3, bit4 for User4
  272.                                     // example:  0x05 means user1 and user3 is enabled.
  273.         char   users[4][MAX_LOGIN_LEN];
  274.         char   passwd[4][MAX_PASSWD_LEN];
  275. }__ATTRIB_PACK__ USERS, *PUSERS;
  276.  
  277. typedef struct _DATETIME
  278. {
  279.         TCPCFG  header;
  280.         char    mode;                    // 0 for manual , 1 for NTP Server
  281.         int     year;
  282.         int     month;
  283.         int     day;
  284.         int     hour;
  285.         int     minutes;
  286.         int     second;
  287.         int     timezone;
  288.         char    server[32];
  289. }__ATTRIB_PACK__ DATETIME, *PDATETIME;
  290.  
  291. extern void enet_agentd_init(void *);
  292. extern void enet_agentd_cleanup(void *);
  293. extern void enet_agentd_start(void *);
  294. extern void enet_agentd_restart(void *);
  295. extern void enet_agentd_stop(void *);
  296. extern bool enet_agentd_isrunning(void *);
  297. __END_C_PROTO__
  298.  
  299. #endif //ENET_SUPPORT_AGENTD
  300. #endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top