Browse Source

slightly redesigned

pull/57/head
Volker Birk 2 months ago
parent
commit
e684b9ab6f
4 changed files with 46 additions and 13 deletions
  1. +15
    -0
      src/pEpEngine.h
  2. +4
    -2
      src/trans_auto.c
  3. +6
    -2
      src/trans_auto.h
  4. +21
    -9
      src/transport.h

+ 15
- 0
src/pEpEngine.h View File

@ -162,6 +162,21 @@ typedef enum {
PEP_STORAGE_ILLEGAL_MESSAGE = 0x1102,
PEP_PEPMESSAGE_ILLEGAL_MESSAGE = 0x1202,
// transport cannot init at all
PEP_TRANSPORT_CANNOT_INIT = 0x2000,
// transport can init recv but not send
PEP_TRANSPORT_CANNOT_INIT_SEND = 0x2001,
// transport can init send but not recv
PEP_TRANSPORT_CANNOT_INIT_RECV = 0x2002,
// transport init good but temporary down
PEP_TRANSPORT_DOWN = 0x2003,
// general error in transport
PEP_TRANSPORT_ERROR = 0x20ff,
PEP_COMMIT_FAILED = 0xff01,
PEP_MESSAGE_CONSUME = 0xff02,
PEP_MESSAGE_IGNORE = 0xff03,


+ 4
- 2
src/trans_auto.c View File

@ -6,13 +6,15 @@
#include "trans_auto.h"
PEP_STATUS auto_sendto(PEP_SESSION session, const message *msg)
PEP_STATUS auto_sendto(PEP_SESSION session, message *msg,
PEP_transport_status_code *tsc)
{
return PEP_STATUS_OK;
}
PEP_STATUS auto_readnext(PEP_SESSION session, message **msg, PEP_transport_t **via)
PEP_STATUS auto_readnext(PEP_SESSION session, message **msg,
PEP_transport_status_code *tsc)
{
return PEP_STATUS_OK;


+ 6
- 2
src/trans_auto.h View File

@ -9,7 +9,9 @@
#include "transport.h"
PEP_STATUS auto_sendto(PEP_SESSION session, const message *msg);
PEP_STATUS auto_sendto(PEP_SESSION session, message *msg,
PEP_transport_status_code *tsc);
/**
* <!-- auto_readnext() -->
*
@ -20,6 +22,8 @@ PEP_STATUS auto_sendto(PEP_SESSION session, const message *msg);
* @param[out] via PEP_transport_t**
*
*/
PEP_STATUS auto_readnext(PEP_SESSION session, message **msg, PEP_transport_t **via);
PEP_STATUS auto_readnext(PEP_SESSION session, message **msg,
PEP_transport_status_code *tsc);
#endif

+ 21
- 9
src/transport.h View File

@ -29,11 +29,19 @@ typedef enum _PEP_transports {
PEP_trans__count
} PEP_transports;
// transports are delivering the transport status code
// this is defined here:
// https://dev.pep.foundation/Engine/TransportStatusCode
typedef uint32_t PEP_transport_status_code;
typedef struct _PEP_transport_t PEP_transport_t;
typedef PEP_STATUS (*sendto_t)(PEP_SESSION session, const message *msg);
typedef PEP_STATUS (*readnext_t)(PEP_SESSION session, message **msg,
PEP_transport_t **via);
typedef PEP_STATUS (*sendto_t)(PEP_SESSION session, message *msg,
PEP_transport_status_code *tsc);
typedef PEP_STATUS (*recvnext_t)(PEP_SESSION session, message **msg,
PEP_transport_status_code *tsc);
/**
* @struct _PEP_transport_t
@ -42,13 +50,17 @@ typedef PEP_STATUS (*readnext_t)(PEP_SESSION session, message **msg,
*
*/
struct _PEP_transport_t {
uint8_t id; // transport ID
PEP_transports id; // transport ID
sendto_t sendto; // sendto function
readnext_t readnext; // readnext function
bool long_message_supported; // flag if this transport supports
// long messages
bool formatted_message_supported; // flag if this transport supports
// formatted messages
recvnext_t readnext; // readnext function
bool is_online_transport;
bool shortmsg_supported;
bool longmsg_supported;
bool longmsg_formatted_supported;
PEP_text_format native_text_format; // native format of the transport
};


Loading…
Cancel
Save