gateway.c 748 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "includes.h"
  2. #include "device.h"
  3. #include "gateway.h"
  4. #include "net_proc.h"
  5. typedef struct _gb_gateway_info {
  6. gb_gateway_bind_info_t bind;
  7. u16 gw_echo_fail_count;
  8. u16 node_echo_fail_count[GB_SUPPORT_MAX_NODE];
  9. } gb_gateway_info_t;
  10. gb_gateway_info_t gw_mgr;
  11. int gateway_gw_id_flush(u32 gw_device_id)
  12. {
  13. int ret = 0;
  14. gw_mgr.bind.gw_device_id = gw_device_id;
  15. gw_mgr.gw_echo_fail_count = 0;
  16. return ret;
  17. }
  18. int gateway_id_cmp(u32 gw_device_id)
  19. {
  20. int ret = 0;
  21. if(gw_mgr.bind.gw_device_id == gw_device_id) {
  22. ret = 1;
  23. }
  24. return ret;
  25. }
  26. int gateway_gw_id_get(u32 *gw_device_id)
  27. {
  28. int ret = 0;
  29. if(gw_device_id) {
  30. *gw_device_id = gw_mgr.bind.gw_device_id;
  31. }
  32. if(gw_mgr.bind.gw_device_id) {
  33. ret = 1;
  34. }
  35. return ret;
  36. }