"Fossies" - the Fresh Open Source Software Archive

Member "opensips-3.0.1/evi/evi_transport.h" (16 Apr 2019, 2848 Bytes) of package /linux/misc/opensips-3.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "evi_transport.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) 2011 OpenSIPS Solutions
    3  *
    4  * This file is part of opensips, a free SIP server.
    5  *
    6  * opensips is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * opensips is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License
   17  * along with this program; if not, write to the Free Software
   18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
   19  *
   20  *
   21  * history:
   22  * ---------
   23  *  2011-05-xx  created (razvancrainea)
   24  */
   25 
   26 #ifndef _EVI_TRANSPORT_H_
   27 #define _EVI_TRANSPORT_H_
   28 
   29 #include <sys/types.h>
   30 #include <sys/un.h>
   31 #include <sys/socket.h>
   32 #include "../mi/mi.h"
   33 #include "../str.h"
   34 #include "../ip_addr.h"
   35 #include "../parser/msg_parser.h"
   36 #include "evi_params.h"
   37 
   38 #define     EVI_ADDRESS     (1 << 1)
   39 #define     EVI_PORT        (1 << 2)
   40 #define     EVI_SOCKET      (1 << 3)
   41 #define     EVI_PARAMS      (1 << 4)
   42 #define     EVI_EXPIRE      (1 << 8) // indicates that the socket may expire
   43 #define     EVI_PENDING     (1 << 9) // indicates that the socket is in use
   44 
   45 /* sockets */
   46 typedef union {
   47     union sockaddr_union udp_addr;
   48     struct sockaddr_un unix_addr;
   49 } sockaddr_reply;
   50 
   51 /* reply socket */
   52 typedef struct ev_reply_sock_ {
   53     unsigned int flags;
   54     unsigned short port;
   55     str address;
   56     unsigned int expire;
   57     long subscription_time;
   58     sockaddr_reply src_addr;
   59     void *params;
   60 } evi_reply_sock;
   61 
   62 /* event raise function */
   63 typedef int (raise_f)(struct sip_msg *msg, str *ev_name,
   64                       evi_reply_sock *sock, evi_params_t * params);
   65 /* socket parse function */
   66 typedef evi_reply_sock* (parse_f)(str);
   67 /* tries to match two sockets */
   68 typedef int (match_f)(evi_reply_sock *sock1, evi_reply_sock *sock2);
   69 /* free a socket */
   70 typedef void (free_f)(evi_reply_sock *sock);
   71 /* prints a given socket */
   72 typedef str (print_f)(evi_reply_sock *sock);
   73 
   74 typedef struct evi_export_ {
   75     str proto;          /* protocol name */
   76     raise_f *raise;     /* raise function */
   77     parse_f *parse;     /* parse function */
   78     match_f *match;     /* sockets match function */
   79     free_f *free;       /* free a socket */
   80     print_f *print;     /* prints a socket */
   81     unsigned int flags;
   82 } evi_export_t;
   83 
   84 
   85 /* transport list */
   86 typedef struct evi_trans_ {
   87     evi_export_t *module;
   88     struct evi_trans_ *next;
   89 } evi_trans_t;
   90 
   91 
   92 /* functions used by the transport modules */
   93 /*
   94  * Used to register a transport module
   95  * Parameters:
   96  *  + export functions
   97  *
   98  * Returns:
   99  *  - 0 if successfull or negative on error
  100  */
  101 int register_event_mod(evi_export_t *ev);
  102 
  103 #endif /* _EVI_TRANSPORT_H_ */