You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. /**
  2. * @file transport.h
  3. * @brief transport structs
  4. * @license GNU General Public License 3.0 - see LICENSE.txt
  5. */
  6. #pragma once
  7. #include "pEpEngine.h"
  8. #include "message.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /**
  13. * @enum PEP_transports
  14. *
  15. * @brief TODO
  16. *
  17. */
  18. typedef enum _PEP_transports {
  19. // auto transport chooses transport per message automatically
  20. PEP_trans_auto = 0,
  21. // PEP_trans_email,
  22. // PEP_trans_whatsapp,
  23. PEP_trans__count
  24. } PEP_transports;
  25. typedef struct _PEP_transport_t PEP_transport_t;
  26. typedef PEP_STATUS (*sendto_t)(PEP_SESSION session, const message *msg);
  27. typedef PEP_STATUS (*readnext_t)(PEP_SESSION session, message **msg,
  28. PEP_transport_t **via);
  29. /**
  30. * @struct _PEP_transport_t
  31. *
  32. * @brief TODO
  33. *
  34. */
  35. struct _PEP_transport_t {
  36. uint8_t id; // transport ID
  37. sendto_t sendto; // sendto function
  38. readnext_t readnext; // readnext function
  39. bool long_message_supported; // flag if this transport supports
  40. // long messages
  41. bool formatted_message_supported; // flag if this transport supports
  42. // formatted messages
  43. PEP_text_format native_text_format; // native format of the transport
  44. };
  45. extern PEP_transport_t transports[PEP_trans__count];
  46. typedef uint64_t transports_mask;
  47. #ifdef __cplusplus
  48. }
  49. #endif