sntp_client.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2013-2022 Michael Zillgith
  3. *
  4. * This file is part of libIEC61850.
  5. *
  6. * libIEC61850 is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * libIEC61850 is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * See COPYING file for the complete license text.
  20. */
  21. #ifndef LIBIEC61850_SRC_COMMON_INC_SNTP_CLIENT_H_
  22. #define LIBIEC61850_SRC_COMMON_INC_SNTP_CLIENT_H_
  23. #include "libiec61850_common_api.h"
  24. #include "hal_socket.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. typedef struct sSNTPClient* SNTPClient;
  29. typedef void (*SNTPClient_UserCallback)(void* parameter, bool isSynced);
  30. LIB61850_API SNTPClient
  31. SNTPClient_create();
  32. LIB61850_API void
  33. SNTPClient_setLocalAddress(SNTPClient self, const char* localAddress);
  34. LIB61850_API void
  35. SNTPClient_setLocalPort(SNTPClient self, int udpPort);
  36. LIB61850_API HandleSet
  37. SNTPClient_getHandleSet(SNTPClient self);
  38. LIB61850_API void
  39. SNTPClient_addServer(SNTPClient self, const char* serverAddr, int serverPort);
  40. LIB61850_API void
  41. SNTPClient_setPollInterval(SNTPClient self, uint32_t intervalInSeconds);
  42. LIB61850_API void
  43. SNTPClient_setUserCallback(SNTPClient self, SNTPClient_UserCallback callback, void* parameter);
  44. LIB61850_API bool
  45. SNTPClient_isSynchronized(SNTPClient self);
  46. LIB61850_API void
  47. SNTPClient_start(SNTPClient self);
  48. LIB61850_API void
  49. SNTPClient_stop(SNTPClient self);
  50. LIB61850_API void
  51. SNTPClient_destroy(SNTPClient self);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* LIBIEC61850_SRC_COMMON_INC_SNTP_CLIENT_H_ */