Browse Source

notification concept

master
Volker Birk 2 months ago
parent
commit
f5d6017792
4 changed files with 51 additions and 35 deletions
  1. +13
    -6
      src/trans_auto.c
  2. +9
    -17
      src/trans_auto.h
  3. +6
    -3
      src/transport.c
  4. +23
    -9
      src/transport.h

+ 13
- 6
src/trans_auto.c View File

@ -6,29 +6,36 @@
#include "trans_auto.h"
PEP_STATUS auto_init(PEP_transport_t *transport,
PEP_SESSION session, PEP_transport_status_code *tsc)
PEP_STATUS auto_startup(PEP_transport_t *transport,
PEP_transport_status_code *tsc)
{
return PEP_STATUS_OK;
}
PEP_STATUS auto_shutdown(PEP_transport_t *transport,
PEP_transport_status_code *tsc)
{
return PEP_STATUS_OK;
}
PEP_STATUS auto_sendto(PEP_SESSION session, message *msg,
stringlist_t **unreachable_addresses, PEP_transport_status_code *tsc)
PEP_transport_status_code *tsc)
{
return PEP_STATUS_OK;
}
PEP_STATUS auto_readnext(PEP_SESSION session, message **msg,
PEP_STATUS auto_recvnext(PEP_SESSION session, message **msg,
PEP_transport_status_code *tsc)
{
return PEP_STATUS_OK;
}
PEP_STATUS auto_signal_statuschange(PEP_transport_id id,
PEP_transport_status_code tsc)
PEP_STATUS auto_notify(signal_statuschange_t status_change,
signal_sendto_result_t sendto_result)
{
return PEP_STATUS_OK;


+ 9
- 17
src/trans_auto.h View File

@ -9,27 +9,19 @@
#include "transport.h"
PEP_STATUS auto_sendto(PEP_SESSION session, message *msg,
stringlist_t **unreachable_addresses, PEP_transport_status_code *tsc);
PEP_STATUS auto_startup(PEP_transport_t *transport,
PEP_transport_status_code *tsc);
/**
* <!-- auto_readnext() -->
*
* @brief TODO
*
* @param[in] session PEP_SESSION
* @param[out] msg message**
* @param[out] via PEP_transport_t**
*
*/
PEP_STATUS auto_shutdown(PEP_transport_t *transport,
PEP_transport_status_code *tsc);
PEP_STATUS auto_init(PEP_transport_t *transport,
PEP_SESSION session, PEP_transport_status_code *tsc);
PEP_STATUS auto_sendto(PEP_SESSION session, message *msg,
PEP_transport_status_code *tsc);
PEP_STATUS auto_readnext(PEP_SESSION session, message **msg,
PEP_STATUS auto_recvnext(PEP_SESSION session, message **msg,
PEP_transport_status_code *tsc);
PEP_STATUS auto_signal_statuschange(PEP_transport_id id,
PEP_transport_status_code tsc);
PEP_STATUS auto_notify(signal_statuschange_t status_change,
signal_sendto_result_t sendto_result);
#endif

+ 6
- 3
src/transport.c View File

@ -22,12 +22,15 @@ PEP_STATUS init_transport_system(PEP_SESSION session, bool in_first)
memset(transports, 0, sizeof(PEP_transport_t) * PEP_trans__count);
transports[PEP_trans_auto].id = PEP_trans_auto;
transports[PEP_trans_auto].uri_scheme = "";
transports[PEP_trans_auto].startup = auto_startup;
transports[PEP_trans_auto].shutdown = auto_shutdown;
transports[PEP_trans_auto].init = auto_init;
transports[PEP_trans_auto].sendto = auto_sendto;
transports[PEP_trans_auto].readnext = auto_readnext;
transports[PEP_trans_auto].recvnext = auto_recvnext;
transports[PEP_trans_auto].signal_statuschange = auto_signal_statuschange;
transports[PEP_trans_auto].notify = auto_notify;
}
return PEP_STATUS_OK;


+ 23
- 9
src/transport.h View File

@ -40,20 +40,32 @@ typedef struct _PEP_transport_t PEP_transport_t;
// functions offered by transport
typedef PEP_STATUS (*init_transport_t)(PEP_transport_t *transport,
PEP_SESSION session, PEP_transport_status_code *tsc);
typedef PEP_STATUS (*startup_transport_t)(PEP_transport_t *transport,
PEP_transport_status_code *tsc);
typedef PEP_STATUS (*shutdown_transport_t)(PEP_transport_t *transport,
PEP_transport_status_code *tsc);
typedef PEP_STATUS (*sendto_t)(PEP_SESSION session, message *msg,
stringlist_t **unreachable_addresses, PEP_transport_status_code *tsc);
PEP_transport_status_code *tsc);
typedef PEP_STATUS (*recvnext_t)(PEP_SESSION session, message **msg,
PEP_transport_status_code *tsc);
// functions offered by transport system
// callbacks
typedef PEP_STATUS (*signal_statuschange_t)(PEP_transport_id id,
PEP_transport_status_code tsc);
typedef PEP_STATUS (*signal_sendto_result_t)(PEP_transport_id id, char *message_id,
char *address, PEP_transport_status_code tsc);
// call this to receive signals
// this function does not terminate until shutdown of the transport
typedef PEP_STATUS (*notify_transport_t)(signal_statuschange_t status_change,
signal_sendto_result_t sendto_result);
/**
* @struct _PEP_transport_t
*
@ -61,19 +73,21 @@ typedef PEP_STATUS (*signal_statuschange_t)(PEP_transport_id id,
*
*/
struct _PEP_transport_t {
PEP_transport_id id; // transport ID
PEP_transport_id id; // transport ID
const char *uri_scheme; // URI scheme this transport is
// covering
// functions offered by transport
init_transport_t init;
startup_transport_t startup;
shutdown_transport_t shutdown;
sendto_t sendto;
recvnext_t readnext;
recvnext_t recvnext;
// functions offered by transport system
notify_transport_t notify;
signal_statuschange_t signal_statuschange;
// functions offered by transport system
bool is_online_transport;


Loading…
Cancel
Save