init.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef INIT_H_
  2. #define INIT_H_
  3. #include "debug.h"
  4. #include "data.h"
  5. /******************************************************************
  6. * Function Name: getIPlist
  7. * Arguments: int[], int*, char*
  8. * Return Value: int
  9. * Date: 2007-6-2
  10. * Description: 读取白名单配置,如果未设置白名单,返回0;反之返回读取的条数
  11. * ip 转换为 int 存储,方便比较
  12. * 注意 数值最大长度为 MAX_IPLIST_NUM = 256
  13. ******************************************************************/
  14. //int getIPlist(int IPlist[MAX_IPLIST_NUM], int *num, char *ipFile);
  15. /******************************************************************
  16. * Function Name: checkIP
  17. * Arguments: int, int[], int
  18. * Return Value: int
  19. * Date: 2007-6-2
  20. * Description: 检查ip是否在白名单中,成功返回 True=1,失败返回False=0
  21. * 如果 _IPnum = 0,返回 True
  22. ******************************************************************/
  23. //int checkIP(int _ip, int _IPlist[MAX_IPLIST_NUM], int _IPnum);
  24. /******************************************************************
  25. * Function Name: initRecordLogin
  26. * Arguments: FILE *logfile,char *fileDir
  27. * Return Value: return_type
  28. * Date: 2007-3-10
  29. * Description: 打开文件,准备保存日志
  30. ******************************************************************/
  31. int initRecordLogin(FILE **logfile, char *fileDir);
  32. /******************************************************************
  33. * Function Name: getInternetIP
  34. * Arguments: int, void*, int, int
  35. * Return Value: int
  36. * Date: 2006-8-17
  37. * Description: 获取本机外网IP,eth0 = 0 eth1 =1
  38. ******************************************************************/
  39. //int getInternetIP(char *localIP, int ethIndex);
  40. /*
  41. * char* GetInitKey(FileName, Section, Key)
  42. * Return Key=>Value
  43. * Ex:
  44. *
  45. * config.ini
  46. * [config]
  47. * dbhost=localhost
  48. *
  49. * Usage:
  50. * char dbhost[20];
  51. * strcpy(dbhost,GetInitKey("config.ini", "config", "dbhost"));
  52. *
  53. * History:
  54. * Chen QunShan@20061010 (chqs_at_sina.com)
  55. * Handle comment line, duplicate section,
  56. * similar key, partly same key, key string existing
  57. * in value, trim left space char
  58. * and the last char is EOF.
  59. */
  60. /******************************************************************
  61. * Function Name: GetInitKey
  62. * Arguments: char*, char*, char*
  63. * Return Value: char*
  64. * Date: 2007-1-17
  65. * Description: 读取配置文件,支持单独一行写注释 以"#"开头
  66. ******************************************************************/
  67. char *GetInitKey(char *filename, char *title, char *key);
  68. //gbk->utf-8
  69. int code_convert(char *inbuf, int inlen, char *outbuf, int outlen);
  70. #endif /*INIT_H_*/