p≡p engine FORK
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.

63 lines
1.5 KiB

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