}
else
{
- AppIdDetector *ad = nullptr;
- AppIdDetectors *appid_detectors = nullptr;
+ AppIdDetector *ad = nullptr;
+ AppIdDetectors *appid_detectors = nullptr;
- if (protocol == IpProtocol::TCP)
+ if (protocol == IpProtocol::TCP)
{
appid_detectors = ServiceDiscovery::get_instance().get_tcp_detectors();
- auto detector = appid_detectors->find(detector_name);
+ auto detector = appid_detectors->find(detector_name);
if (detector != appid_detectors->end())
ad = detector->second;
}
- else if (protocol == IpProtocol::UDP)
+ else if (protocol == IpProtocol::UDP)
{
appid_detectors = ServiceDiscovery::get_instance().get_udp_detectors();
- auto detector = appid_detectors->find(detector_name);
+ auto detector = appid_detectors->find(detector_name);
if (detector != appid_detectors->end())
ad = detector->second;
}
- sd = (ServiceDetector*)ad;
+ sd = (ServiceDetector*)ad;
}
UserData<LuaServiceObject>::push(L, DETECTOR, this);
}
else
{
- AppIdDetector *ad = nullptr;
- AppIdDetectors *appid_detectors = nullptr;
+ AppIdDetector *ad = nullptr;
+ AppIdDetectors *appid_detectors = nullptr;
- if (protocol == IpProtocol::TCP)
+ if (protocol == IpProtocol::TCP)
{
appid_detectors = ClientDiscovery::get_instance().get_tcp_detectors();
- auto detector = appid_detectors->find(detector_name);
+ auto detector = appid_detectors->find(detector_name);
if (detector != appid_detectors->end())
ad = detector->second;
}
- else if (protocol == IpProtocol::UDP)
+ else if (protocol == IpProtocol::UDP)
{
appid_detectors = ClientDiscovery::get_instance().get_udp_detectors();
- auto detector = appid_detectors->find(detector_name);
+ auto detector = appid_detectors->find(detector_name);
if (detector != appid_detectors->end())
ad = detector->second;
}
- cd = (ClientDetector*)ad;
+ cd = (ClientDetector*)ad;
}
UserData<LuaClientObject>::push(L, DETECTOR, this);
{
fd.rstate = FTP_REPLY_MID;
if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_MULTI))
- return -1;
+ return -1;
if (fd.rstate == FTP_REPLY_MID)
- fd.rstate = FTP_REPLY_LONG;
+ fd.rstate = FTP_REPLY_LONG;
}
else
{
tmp_state = fd.rstate;
fd.rstate = FTP_REPLY_MID;
if (ftp_parse_response(data, offset, size, fd, tmp_state))
- return -1;
+ return -1;
if (fd.rstate == FTP_REPLY_MID)
- fd.rstate = FTP_REPLY_LONG;
+ fd.rstate = FTP_REPLY_LONG;
}
break;
case FTP_REPLY_LONG:
fd.rstate = FTP_REPLY_MID;
- if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_LONG))
- return -1;
+ if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_LONG))
+ return -1;
if (++offset >= size)
{
fd.rstate = FTP_REPLY_BEGIN;
break;
}
- if (fd.rstate == FTP_REPLY_MID)
- {
+ if (fd.rstate == FTP_REPLY_MID)
+ {
fd.rstate = FTP_REPLY_LONG;
- break;
- }
+ break;
+ }
if (size - offset < (int)sizeof(ServiceFTPCode))
{
- fd.rstate = FTP_REPLY_MID;
- if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_LONG))
- return -1;
+ fd.rstate = FTP_REPLY_MID;
+ if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_LONG))
+ return -1;
if (fd.rstate == FTP_REPLY_MID)
fd.rstate = FTP_REPLY_LONG;
}
else
- {
- code_hdr = (const ServiceFTPCode*)(data + offset);
+ {
+ code_hdr = (const ServiceFTPCode*)(data + offset);
if(code_hdr->code[0] >= '1' and code_hdr->code[0] <= '5' and
code_hdr->code[1] >= '1' and code_hdr->code[1] <= '5' and
isdigit(code_hdr->code[2]))
if (tmp == fd.code)
{
offset += sizeof(ServiceFTPCode);
- if (code_hdr->sp == ' ' or code_hdr->sp == 0x09)
- {
- fd.rstate = FTP_REPLY_MID;
- if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_BEGIN))
- return -1;
- }
- else if (code_hdr->sp == '-')
- {
- fd.rstate = FTP_REPLY_MID;
- if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_MULTI))
- return -1;
- }
- if (fd.rstate == FTP_REPLY_MID)
+ if (code_hdr->sp == ' ' or code_hdr->sp == 0x09)
+ {
+ fd.rstate = FTP_REPLY_MID;
+ if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_BEGIN))
+ return -1;
+ }
+ else if (code_hdr->sp == '-')
+ {
+ fd.rstate = FTP_REPLY_MID;
+ if (ftp_parse_response(data, offset, size, fd, FTP_REPLY_MULTI))
+ return -1;
+ }
+ if (fd.rstate == FTP_REPLY_MID)
fd.rstate = FTP_REPLY_LONG;
}
}
- }
+ }
break;
default:
return -1;
}
};
-AppIdSession::AppIdSession(IpProtocol, const SfIp*, uint16_t, AppIdInspector& inspector)
- : FlowData(inspector_id, &inspector)
+AppIdSession::AppIdSession(IpProtocol proto, const SfIp*, uint16_t, AppIdInspector& inspector)
+ : FlowData(inspector_id, &inspector), protocol(proto)
{
common.flow_type = APPID_FLOW_TYPE_NORMAL;
service_port = APPID_UT_SERVICE_PORT;
AppidChangeBits change_bits;
+ memset(application_ids, 0, sizeof(application_ids));
client.update_user(APPID_UT_ID, APPID_UT_USERNAME);
client.set_version(APPID_UT_CLIENT_VERSION, change_bits);