"Fossies" - the Fresh Open Source Software Archive

Member "snort-2.9.17/src/dynamic-preprocessors/appid/appInfoTable.h" (16 Oct 2020, 4214 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 "appInfoTable.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 /*
    2 ** Copyright (C) 2014-2020 Cisco and/or its affiliates. All rights reserved.
    3 ** Copyright (C) 2005-2013 Sourcefire, Inc.
    4 **
    5 ** This program is free software; you can redistribute it and/or modify
    6 ** it under the terms of the GNU General Public License Version 2 as
    7 ** published by the Free Software Foundation.  You may not use, modify or
    8 ** distribute this program under any other version of the GNU General
    9 ** Public License.
   10 **
   11 ** This program 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 
   22 #ifndef __APP_INFO_TABLE_H__
   23 #define __APP_INFO_TABLE_H__
   24 
   25 #include "appId.h"
   26 #include "client_app_api.h"
   27 #include "detector_api.h"
   28 #include "service_api.h"
   29 
   30 #define APP_PRIORITY_DEFAULT 2
   31 #define HTTP_TUNNEL_DETECT_RESTART 0
   32 #define HTTP_TUNNEL_DETECT_RESTART_AND_RESET 1
   33 
   34 typedef enum
   35 {
   36     APPINFO_FLAG_SERVICE_ADDITIONAL = (1<<0),
   37     APPINFO_FLAG_SERVICE_UDP_REVERSED = (1<<1),
   38     APPINFO_FLAG_CLIENT_ADDITIONAL = (1<<2),
   39     APPINFO_FLAG_CLIENT_USER = (1<<3),
   40     APPINFO_FLAG_ACTIVE = (1<<4),
   41     APPINFO_FLAG_SSL_INSPECT =  (1<<5),
   42     APPINFO_FLAG_REFERRED =  (1<<6),
   43     APPINFO_FLAG_DEFER =  (1<<7),
   44 
   45     APPINFO_FLAG_IGNORE =  (1<<8),
   46     APPINFO_FLAG_SSL_SQUELCH =  (1<<9),
   47     APPINFO_FLAG_PERSISTENT =  (1<<10),
   48     APPINFO_FLAG_TP_CLIENT = (1<<11),
   49     APPINFO_FLAG_DEFER_PAYLOAD =  (1<<12),
   50     APPINFO_FLAG_SEARCH_ENGINE =  (1<<13),
   51     APPINFO_FLAG_SUPPORTED_SEARCH = (1<<14),
   52 
   53     APPINFO_FLAG_CLIENT_DETECTOR_CALLBACK = (1<<15),
   54     APPINFO_FLAG_SERVICE_DETECTOR_CALLBACK = (1<<16)
   55 } tAppInfoFlags;
   56 
   57 struct _AppInfoTableEntry
   58 {
   59     struct _AppInfoTableEntry *next;
   60     tAppId     appId;
   61     uint32_t   serviceId;
   62     uint32_t   clientId;
   63     uint32_t   payloadId;
   64     int16_t    snortId;
   65     uint32_t   flags;
   66     tRNAClientAppModule *clntValidator;
   67     tRNAServiceElement *svrValidator;
   68     uint32_t  priority;
   69     char       *appName;
   70 };
   71 typedef struct _AppInfoTableEntry AppInfoTableEntry;
   72 
   73 void appInfoTableInit(tAppidStaticConfig* appidSC, tAppIdConfig* pConfig);
   74 void appInfoTableFini(tAppIdConfig *pConfig);
   75 AppInfoTableEntry* appInfoEntryGet(tAppId appId, const tAppIdConfig *pConfig);
   76 AppInfoTableEntry* appInfoEntryCreate(const char *appName, tAppIdConfig *pConfig);
   77 tAppId appGetSnortIdFromAppId(tAppId appId);
   78 void AppIdDumpStats(int exit_flag);
   79 void appInfoTableDump(tAppIdConfig *pConfig);
   80 void appInfoSetActive(tAppId appId, bool active);
   81 const char * appGetAppName(int32_t appId);
   82 int32_t appGetAppId(const char *appName);
   83 
   84 static inline void appInfoEntryFlagSet (tAppId appId, unsigned flags, const tAppIdConfig *pConfig)
   85 {
   86     AppInfoTableEntry* entry = appInfoEntryGet(appId, pConfig);
   87     if (entry)
   88         entry->flags |= flags;
   89 }
   90 
   91 static inline void appInfoEntryFlagClear (tAppId appId, unsigned flags, const tAppIdConfig *pConfig)
   92 {
   93     AppInfoTableEntry* entry = appInfoEntryGet(appId, pConfig);
   94     if (entry)
   95         entry->flags &= (~flags);
   96 }
   97 
   98 static inline unsigned appInfoEntryFlagGet (tAppId app_id, unsigned flags, const tAppIdConfig *pConfig)
   99 {
  100     AppInfoTableEntry* entry = appInfoEntryGet(app_id, pConfig);
  101     if (entry)
  102         return (entry->flags & flags);
  103     return 0;
  104 }
  105 
  106 static inline uint32_t appInfoEntryFlags (tAppId app_id, const tAppIdConfig *pConfig)
  107 {
  108     AppInfoTableEntry* entry = appInfoEntryGet(app_id, pConfig);
  109     if (entry)
  110         return entry->flags;
  111     return 0;
  112 }
  113 
  114 static inline void appInfoEntryPrioritySet (tAppId appId, unsigned priority, const tAppIdConfig *pConfig)
  115 {
  116     AppInfoTableEntry* entry = appInfoEntryGet(appId, pConfig);
  117     if (entry)
  118         entry->priority |= priority;
  119 }
  120 
  121 static inline unsigned appInfoEntryPriorityGet (tAppId app_id, const tAppIdConfig *pConfig)
  122 {
  123     AppInfoTableEntry* entry = appInfoEntryGet(app_id, pConfig);
  124     if (entry)
  125         return (entry->priority);
  126     return 0;
  127 }
  128 
  129 
  130 #endif