exosip2.h

来自「libosip2-3版本的osip源代码」· C头文件 代码 · 共 570 行 · 第 1/2 页

H
570
字号
/*  eXosip - This is the eXtended osip library.  Copyright (C) 2002, 2003  Aymeric MOIZARD  - jack@atosc.org    eXosip is free software; you can redistribute it and/or modify  it under the terms of the GNU General Public License as published by  the Free Software Foundation; either version 2 of the License, or  (at your option) any later version.    eXosip is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.    You should have received a copy of the GNU General Public License  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#ifdef ENABLE_MPATROL#include <mpatrol.h>#endif#ifndef __EXOSIP2_H__#define __EXOSIP2_H__#ifdef _WIN32_WCE#include <stdio.h>#include <stdlib.h>#include <winsock2.h>#include <osipparser2/osip_port.h>#include <ws2tcpip.h>#define close(s) closesocket(s)#elif WIN32#include <stdio.h>#include <stdlib.h>#include <winsock2.h>#include <ws2tcpip.h>#define close(s) closesocket(s)#else#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netdb.h>#endif#include <stdio.h>#include <osip2/osip.h>#include <osip2/osip_dialog.h>#include <eXosip2/eXosip.h>#include "jpipe.h"#ifndef JD_EMPTY#define JD_EMPTY          0#define JD_INITIALIZED    1#define JD_TRYING         2#define JD_QUEUED         3#define JD_RINGING        4#define JD_ESTABLISHED    5#define JD_REDIRECTED     6#define JD_AUTH_REQUIRED  7#define JD_CLIENTERROR    8#define JD_SERVERERROR    9#define JD_GLOBALFAILURE  10#define JD_TERMINATED     11#define JD_MAX            11#endif#define EXOSIP_VERSION	"3.0.1"#ifdef __cplusplusextern "C"{#endif  void eXosip_update (void);  void __eXosip_wakeup (void);  struct __eXosip_sockaddr  {    u_char ss_len;    u_char ss_family;    u_char padding[128 - 2];  };  typedef struct eXosip_dialog_t eXosip_dialog_t;  struct eXosip_dialog_t  {    int d_id;    int d_STATE;    osip_dialog_t *d_dialog;    /* active dialog */    time_t d_timer;	int d_count;    osip_message_t *d_200Ok;    osip_message_t *d_ack;    osip_list_t *d_inc_trs;    osip_list_t *d_out_trs;    int d_retry;                /* avoid too many unsuccessfull retry */    eXosip_dialog_t *next;    eXosip_dialog_t *parent;  };  typedef struct eXosip_subscribe_t eXosip_subscribe_t;  struct eXosip_subscribe_t  {    int s_id;    int s_ss_status;    int s_ss_reason;    int s_reg_period;    eXosip_dialog_t *s_dialogs;    int s_retry;                /* avoid too many unsuccessfull retry */    osip_transaction_t *s_inc_tr;    osip_transaction_t *s_out_tr;    eXosip_subscribe_t *next;    eXosip_subscribe_t *parent;  };  typedef struct eXosip_notify_t eXosip_notify_t;  struct eXosip_notify_t  {    int n_id;    char n_uri[255];    int n_online_status;    int n_ss_status;    int n_ss_reason;    time_t n_ss_expires;    eXosip_dialog_t *n_dialogs;    osip_transaction_t *n_inc_tr;    osip_transaction_t *n_out_tr;    eXosip_notify_t *next;    eXosip_notify_t *parent;  };  typedef struct eXosip_call_t eXosip_call_t;  struct eXosip_call_t  {    int c_id;    eXosip_dialog_t *c_dialogs;    osip_transaction_t *c_inc_tr;    osip_transaction_t *c_out_tr;    int c_retry;                /* avoid too many unsuccessfull retry */    osip_transaction_t *c_inc_options_tr;    osip_transaction_t *c_out_options_tr;    void *external_reference;    /* cache old credentials for reuse in next request */    osip_message_t *response_auth;    eXosip_call_t *next;    eXosip_call_t *parent;  };  typedef struct eXosip_reg_t eXosip_reg_t;  struct eXosip_reg_t  {    int r_id;    int r_reg_period;           /* delay between registration */    char *r_aor;                /* sip identity */    char *r_registrar;          /* registrar */    char *r_contact;            /* list of contacts string */    osip_transaction_t *r_last_tr;    int r_retry;                /* avoid too many unsuccessfull retry */    char transport[10];         /* transport used for registration */    struct __eXosip_sockaddr addr;    int len;    eXosip_reg_t *next;    eXosip_reg_t *parent;  };  typedef struct eXosip_pub_t eXosip_pub_t;  struct eXosip_pub_t  {    int p_id;    time_t p_expires;           /* expiration date (started+period) */    int p_period;               /* delay between registration */    char p_aor[256];            /* sip identity */    char p_sip_etag[64];        /* sip_etag from 200ok */    osip_transaction_t *p_last_tr;    eXosip_pub_t *next;    eXosip_pub_t *parent;  };  int _eXosip_pub_update (eXosip_pub_t ** pub, osip_transaction_t * tr,                          osip_message_t * answer);  int _eXosip_pub_find_by_aor (eXosip_pub_t ** pub, const char *aor);  int _eXosip_pub_find_by_tid (eXosip_pub_t ** pjp, int tid);  int _eXosip_pub_init (eXosip_pub_t ** pub, const char *aor, const char *exp);  void _eXosip_pub_free (eXosip_pub_t * pub);  typedef struct jauthinfo_t jauthinfo_t;  struct jauthinfo_t  {    char username[50];    char userid[50];    char passwd[50];    char ha1[50];    char realm[50];    jauthinfo_t *parent;    jauthinfo_t *next;  };  int    __eXosip_create_authorization_header (osip_message_t * previous_answer,                                          const char *rquri,                                          const char *username,                                          const char *passwd,                                          const char *ha1,                                          osip_authorization_t ** auth,                                          const char *method);  int __eXosip_create_proxy_authorization_header (osip_message_t *                                                  previous_answer,                                                  const char *rquri,                                                  const char *username,                                                  const char *passwd,                                                  const char *ha1,                                                  osip_proxy_authorization_t                                                  ** auth, const char *method);  eXosip_event_t *eXosip_event_init_for_call (int type, eXosip_call_t * jc,                                              eXosip_dialog_t * jd,                                              osip_transaction_t * tr);  eXosip_event_t *eXosip_event_init_for_subscribe (int type,                                                   eXosip_subscribe_t * js,                                                   eXosip_dialog_t * jd,                                                   osip_transaction_t * tr);  eXosip_event_t *eXosip_event_init_for_notify (int type,                                                eXosip_notify_t * jn,                                                eXosip_dialog_t * jd,                                                osip_transaction_t * tr);  eXosip_event_t *eXosip_event_init_for_reg (int type, eXosip_reg_t * jr,                                             osip_transaction_t * tr);  eXosip_event_t *eXosip_event_init_for_message (int type,                                                 osip_transaction_t * tr);  int eXosip_event_init (eXosip_event_t ** je, int type);  void report_call_event (int evt, eXosip_call_t * jc, eXosip_dialog_t * jd,                          osip_transaction_t * tr);  void report_options_event (int evt, osip_transaction_t * tr);  void report_event (eXosip_event_t * je, osip_message_t * sip);  int eXosip_event_add (eXosip_event_t * je);  eXosip_event_t *eXosip_event_wait (int tv_s, int tv_ms);  eXosip_event_t *eXosip_event_get (void);  typedef void (*eXosip_callback_t) (int type, eXosip_event_t *);  char *strdup_printf (const char *fmt, ...);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?