re/include/re_sipevent.h

124 lines
3.9 KiB
C
Raw Permalink Normal View History

2011-11-14 14:03:31 +00:00
/**
* @file re_sipevent.h SIP Event Framework
*
* Copyright (C) 2010 Creytiv.com
*/
2011-12-02 14:09:27 +00:00
2011-12-14 14:49:59 +00:00
/* Message Components */
struct sipevent_event {
struct pl event;
struct pl params;
struct pl id;
};
enum sipevent_subst {
SIPEVENT_ACTIVE = 0,
SIPEVENT_PENDING,
SIPEVENT_TERMINATED,
};
enum sipevent_reason {
2011-12-15 13:00:20 +00:00
SIPEVENT_DEACTIVATED = 0,
SIPEVENT_PROBATION,
SIPEVENT_REJECTED,
SIPEVENT_TIMEOUT,
SIPEVENT_GIVEUP,
2011-12-14 14:49:59 +00:00
SIPEVENT_NORESOURCE,
};
struct sipevent_substate {
enum sipevent_subst state;
2011-12-19 07:30:33 +00:00
enum sipevent_reason reason;
2011-12-14 14:49:59 +00:00
struct pl expires;
2011-12-19 11:50:38 +00:00
struct pl retry_after;
2011-12-19 07:30:33 +00:00
struct pl params;
2011-12-14 14:49:59 +00:00
};
int sipevent_event_decode(struct sipevent_event *se, const struct pl *pl);
int sipevent_substate_decode(struct sipevent_substate *ss,
const struct pl *pl);
const char *sipevent_substate_name(enum sipevent_subst state);
const char *sipevent_reason_name(enum sipevent_reason reason);
2011-12-02 14:09:27 +00:00
/* Listener Socket */
2011-11-30 08:08:20 +00:00
struct sipevent_sock;
2011-11-14 14:03:31 +00:00
2011-11-30 08:08:20 +00:00
int sipevent_listen(struct sipevent_sock **sockp, struct sip *sip,
uint32_t htsize_not, uint32_t htsize_sub,
sip_msg_h *subh, void *arg);
2011-11-30 13:59:29 +00:00
2011-12-14 14:49:59 +00:00
/* Notifier */
struct sipnot;
2011-12-19 12:28:37 +00:00
typedef void (sipnot_close_h)(int err, const struct sip_msg *msg, void *arg);
2011-12-14 14:49:59 +00:00
int sipevent_accept(struct sipnot **notp, struct sipevent_sock *sock,
const struct sip_msg *msg, struct sip_dialog *dlg,
const struct sipevent_event *event,
2011-12-16 11:41:46 +00:00
uint16_t scode, const char *reason, uint32_t expires_min,
uint32_t expires_dfl, uint32_t expires_max,
const char *cuser, const char *ctype,
2011-12-14 14:49:59 +00:00
sip_auth_h *authh, void *aarg, bool aref,
2011-12-19 12:28:37 +00:00
sipnot_close_h *closeh, void *arg, const char *fmt, ...);
2011-12-23 07:56:23 +00:00
int sipevent_notify(struct sipnot *sipnot, struct mbuf *mb,
2011-12-16 17:33:02 +00:00
enum sipevent_subst state, enum sipevent_reason reason,
uint32_t retry_after);
2011-12-23 07:56:23 +00:00
int sipevent_notifyf(struct sipnot *sipnot, struct mbuf **mbp,
2011-12-16 17:33:02 +00:00
enum sipevent_subst state, enum sipevent_reason reason,
uint32_t retry_after, const char *fmt, ...);
2011-12-14 14:49:59 +00:00
2011-12-02 14:09:27 +00:00
/* Subscriber */
2011-12-06 13:44:37 +00:00
struct sipsub;
2011-12-19 12:28:37 +00:00
typedef int (sipsub_fork_h)(struct sipsub **subp, struct sipsub *osub,
const struct sip_msg *msg, void *arg);
typedef void (sipsub_notify_h)(struct sip *sip, const struct sip_msg *msg,
void *arg);
typedef void (sipsub_close_h)(int err, const struct sip_msg *msg,
const struct sipevent_substate *substate,
void *arg);
2011-11-30 13:59:29 +00:00
2011-11-30 08:08:20 +00:00
int sipevent_subscribe(struct sipsub **subp, struct sipevent_sock *sock,
2011-12-02 14:09:27 +00:00
const char *uri, const char *from_name,
2011-12-08 11:41:49 +00:00
const char *from_uri, const char *event, const char *id,
2011-11-30 08:08:20 +00:00
uint32_t expires, const char *cuser,
2011-11-14 14:03:31 +00:00
const char *routev[], uint32_t routec,
sip_auth_h *authh, void *aarg, bool aref,
2011-12-19 12:28:37 +00:00
sipsub_fork_h *forkh, sipsub_notify_h *notifyh,
sipsub_close_h *closeh, void *arg,
2011-12-06 13:44:37 +00:00
const char *fmt, ...);
2011-12-08 15:11:31 +00:00
int sipevent_dsubscribe(struct sipsub **subp, struct sipevent_sock *sock,
struct sip_dialog *dlg, const char *event,
const char *id, uint32_t expires, const char *cuser,
sip_auth_h *authh, void *aarg, bool aref,
2011-12-19 12:28:37 +00:00
sipsub_notify_h *notifyh, sipsub_close_h *closeh,
2011-12-08 15:11:31 +00:00
void *arg, const char *fmt, ...);
2011-11-30 13:59:29 +00:00
int sipevent_refer(struct sipsub **subp, struct sipevent_sock *sock,
const char *uri, const char *from_name,
2011-12-16 11:12:04 +00:00
const char *from_uri, const char *cuser,
const char *routev[], uint32_t routec,
2011-11-30 13:59:29 +00:00
sip_auth_h *authh, void *aarg, bool aref,
2011-12-19 12:28:37 +00:00
sipsub_fork_h *forkh, sipsub_notify_h *notifyh,
sipsub_close_h *closeh, void *arg,
2011-12-06 13:44:37 +00:00
const char *fmt, ...);
2011-12-08 15:11:31 +00:00
int sipevent_drefer(struct sipsub **subp, struct sipevent_sock *sock,
2011-12-16 11:12:04 +00:00
struct sip_dialog *dlg, const char *cuser,
2011-12-08 15:11:31 +00:00
sip_auth_h *authh, void *aarg, bool aref,
2011-12-19 12:28:37 +00:00
sipsub_notify_h *notifyh, sipsub_close_h *closeh,
2011-12-08 15:11:31 +00:00
void *arg, const char *fmt, ...);
2011-12-06 13:44:37 +00:00
int sipevent_fork(struct sipsub **subp, struct sipsub *osub,
const struct sip_msg *msg,
sip_auth_h *authh, void *aarg, bool aref,
2011-12-19 12:28:37 +00:00
sipsub_notify_h *notifyh, sipsub_close_h *closeh,
2011-12-06 13:44:37 +00:00
void *arg);