"Fossies" - the Fresh Open Source Software Archive

Member "snort-2.9.17/src/preprocessors/sip_common.h" (16 Oct 2020, 3615 Bytes) of package /linux/misc/snort-2.9.17.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 "sip_common.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.9.16.1_vs_2.9.17.

    1 /* $Id$ */
    2 /*
    3  ** Copyright (C) 2014-2020 Cisco and/or its affiliates. All rights reserved.
    4  * ** Copyright (C) 2005-2013 Sourcefire, Inc.
    5  * ** AUTHOR: Steven Sturges
    6  * **
    7  * ** This program is free software; you can redistribute it and/or modify
    8  * ** it under the terms of the GNU General Public License Version 2 as
    9  * ** published by the Free Software Foundation.  You may not use, modify or
   10  * ** distribute this program under any other version of the GNU General
   11  * ** Public License.
   12  * **
   13  * ** This program is distributed in the hope that it will be useful,
   14  * ** but WITHOUT ANY WARRANTY; without even the implied warranty of
   15  * ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16  * ** GNU General Public License for more details.
   17  * **
   18  * ** You should have received a copy of the GNU General Public License
   19  * ** along with this program; if not, write to the Free Software
   20  * ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   21  * */
   22 
   23 /* sip_common.h
   24  *
   25  * Purpose: Common SIP Definition shared between preprocessors.
   26  *
   27  * Arguments:
   28  *
   29  * Effect:
   30  *
   31  * Comments:
   32  *
   33  * Any comments?
   34  *
   35  */
   36 
   37 #ifndef SIP_COMMON_H_
   38 #define SIP_COMMON_H_
   39 
   40 typedef enum _SIP_method
   41 {
   42     SIP_METHOD_NULL        = 0, //0x0000,
   43     SIP_METHOD_INVITE      = 1, //0x0001,
   44     SIP_METHOD_CANCEL      = 2, //0x0002,
   45     SIP_METHOD_ACK         = 3, //0x0004,
   46     SIP_METHOD_BYE         = 4, //0x0008,
   47     SIP_METHOD_REGISTER    = 5, //0x0010,
   48     SIP_METHOD_OPTIONS     = 6, //0x0020,
   49     SIP_METHOD_REFER       = 7, //0x0040,
   50     SIP_METHOD_SUBSCRIBE   = 8, //0x0080,
   51     SIP_METHOD_UPDATE      = 9, //0x0100,
   52     SIP_METHOD_JOIN        = 10,//0x0200,
   53     SIP_METHOD_INFO        = 11,//0x0400,
   54     SIP_METHOD_MESSAGE     = 12,//0x0800,
   55     SIP_METHOD_NOTIFY      = 13,//0x1000,
   56     SIP_METHOD_PRACK       = 14,//0x2000,
   57     SIP_METHOD_USER_DEFINE = 15,//0x4000,
   58     SIP_METHOD_USER_DEFINE_MAX = 32//0x80000000,
   59 
   60 } SIPMethodsFlag;
   61 
   62 typedef struct _SipHeaders
   63 {
   64     const char *callid;
   65     const char *from;
   66     const char *userAgent;
   67     const char *server;
   68     const char *userName;
   69     uint16_t callidLen;
   70     uint16_t fromLen;
   71     uint16_t userAgentLen;
   72     uint16_t serverLen;
   73     uint16_t userNameLen;
   74 
   75     SIPMethodsFlag methodFlag;
   76 } SipHeaders;
   77 
   78 typedef enum _SIP_DialogState
   79 {
   80    SIP_DLG_CREATE = 1,    //1
   81    SIP_DLG_INVITING,      //2
   82    SIP_DLG_EARLY,         //3
   83    SIP_DLG_AUTHENCATING,  //4
   84    SIP_DLG_ESTABLISHED,   //5
   85    SIP_DLG_REINVITING,    //6
   86    SIP_DLG_TERMINATING,   //7
   87    SIP_DLG_TERMINATED     //8
   88 } SIP_DialogState;
   89 
   90 typedef struct _SIP_MediaData
   91 {
   92     sfaddr_t maddress;  // media IP
   93     uint16_t mport;   // media port
   94     uint8_t numPort;   // number of media ports
   95     struct _SIP_MediaData *nextM;
   96 } SIP_MediaData;
   97 
   98 typedef SIP_MediaData* SIP_MediaDataList;
   99 
  100 typedef struct _SIP_MediaSession
  101 {
  102     uint32_t sessionID; // a hash value of the session
  103     int savedFlag;      // whether this data has been saved by a dialog,
  104                         // if savedFlag = 1, this session will be deleted after sip message is processed.
  105     sfaddr_t maddress_default;  //Default media IP
  106     SIP_MediaDataList medias; //Media list in the session
  107     struct _SIP_MediaSession *nextS; // Next media session
  108 } SIP_MediaSession;
  109 
  110 typedef SIP_MediaSession* SIP_MediaList;
  111 
  112 typedef struct _SipDialog
  113 {
  114     SIP_DialogState state;
  115     bool          mediaUpdated;
  116     SIP_MediaList mediaSessions;
  117 } SipDialog;
  118 
  119 typedef struct _SipEventData
  120 {
  121     SFSnortPacket *packet;
  122     const SipHeaders *headers;
  123     const SipDialog  *dialog;
  124 } SipEventData;
  125 
  126 typedef enum _SipEventType
  127 {
  128     SIP_EVENT_TYPE_SIP_DIALOG
  129 } SipEventType;
  130 
  131 #endif /* SIP_COMMON_H_ */