#include "service_plugins/service_discovery.h"
#ifdef ENABLE_APPID_THIRD_PARTY
#include "tp_lib_handler.h"
+#include "tp_appid_utils.h"
#endif
using namespace snort;
-bool do_tp_discovery(AppIdSession&, IpProtocol, Packet*, AppidSessionDirection&);
-
AppIdDiscovery::AppIdDiscovery(AppIdInspector& ins)
: inspector(ins)
{
patterns[1].pattern = (const uint8_t*)referer_path;
patterns[1].patternSize = referer_path_len;
patterns[2].pattern = nullptr;
- HostUrlDetectorPattern* data = (HostUrlDetectorPattern*)mlmpMatchPatternUrl(matcher,
+ HostUrlDetectorPattern* url_pattern_data = (HostUrlDetectorPattern*)mlmpMatchPatternUrl(matcher,
patterns);
- if ( data != nullptr )
+ if ( url_pattern_data != nullptr )
{
if ( payload_found )
*referredPayloadAppId = *payloadAppId;
else
payload_found = true;
- *payloadAppId = data->payload_id;
+ *payloadAppId = url_pattern_data->payload_id;
}
}
}
// move it to the detector classes
//int detector_user_data_ref = 0; // key into LUA_REGISTRYINDEX
DetectorPackageInfo package_info;
- unsigned int service_id = APP_ID_UNKNOWN;
+ AppId service_id = APP_ID_UNKNOWN;
int lua_validate(AppIdDiscoveryArgs&);
};
if (fp) // initialize data session
{
- uint64_t flags = asd.get_session_flags(APPID_SESSION_ENCRYPTED | APPID_SESSION_DECRYPTED);
- if (flags == APPID_SESSION_ENCRYPTED)
+ uint64_t encrypted_flags = asd.get_session_flags(APPID_SESSION_ENCRYPTED | APPID_SESSION_DECRYPTED);
+ if (encrypted_flags == APPID_SESSION_ENCRYPTED)
{
fp->service.set_id(APP_ID_FTPSDATA);
}
else
{
- flags = 0; // reset (APPID_SESSION_ENCRYPTED | APPID_SESSION_DECRYPTED) bits
+ encrypted_flags = 0; // reset (APPID_SESSION_ENCRYPTED | APPID_SESSION_DECRYPTED) bits
fp->service.set_id(APP_ID_FTP_DATA);
}
- initialize_expected_session(asd, *fp, APPID_SESSION_IGNORE_ID_FLAGS | flags, dir);
+ initialize_expected_session(asd, *fp, APPID_SESSION_IGNORE_ID_FLAGS | encrypted_flags, dir);
}
}
#include "stream/stream.h"
#ifdef ENABLE_APPID_THIRD_PARTY
#include "tp_lib_handler.h"
+#include "tp_appid_utils.h"
#endif
using namespace std;
THREAD_LOCAL ProfileStats tpLibPerfStats;
THREAD_LOCAL ProfileStats tpPerfStats;
-bool do_tp_discovery(AppIdSession&, IpProtocol, Packet*, AppidSessionDirection&);
-
// std::vector does not have a convenient find() function.
// There is a generic std::find() in <algorithm>, but this might be faster.
template<class Type_t, class ValType_t>
--- /dev/null
+//--------------------------------------------------------------------------
+// Copyright (C) 2018-2018 Cisco and/or its affiliates. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License Version 2 as published
+// by the Free Software Foundation. You may not use, modify or distribute
+// this program under any other version of the GNU General Public License.
+//
+// This program 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//--------------------------------------------------------------------------
+
+// tp_appid_utils.h author Devendra Dahiphale<ddahipha@cisco.com>
+
+#ifndef TP_APPID_UTILS_H
+#define TP_APPID_UTILS_H
+
+#include "protocols/packet.h"
+#include "appid_types.h"
+
+class AppIdSession;
+
+bool do_tp_discovery(AppIdSession&, IpProtocol, snort::Packet*, AppidSessionDirection&);
+
+#endif