本文整理汇总了C++中DynamicPreprocessorData::debugMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicPreprocessorData::debugMsg方法的具体用法?C++ DynamicPreprocessorData::debugMsg怎么用?C++ DynamicPreprocessorData::debugMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicPreprocessorData
的用法示例。
在下文中一共展示了DynamicPreprocessorData::debugMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExampleSetup
void ExampleSetup()
{
_dpd.registerPreproc("dynamic_example", ExampleInit, 0, 0, 0);
DEBUG_WRAP(_dpd.debugMsg(DEBUG_PLUGIN, "Preprocessor: Example is setup\n"););
示例2: ParseDNSResponseMessage
void ParseDNSResponseMessage(SFSnortPacket *p, DNSSessionData *dnsSessionData)
{
u_int16_t bytes_unused = p->payload_size;
int i;
unsigned char *data = p->payload;
while (bytes_unused)
{
/* Parse through the DNS Header */
if (dnsSessionData->state < DNS_RESP_STATE_QUESTION)
{
/* Length only applies on a TCP packet, skip to header ID
* if at beginning of a UDP Response.
*/
if ((dnsSessionData->state == DNS_RESP_STATE_LENGTH) &&
(p->udp_header))
{
dnsSessionData->state = DNS_RESP_STATE_HDR_ID;
}
bytes_unused = ParseDNSHeader(data, bytes_unused, dnsSessionData);
if (bytes_unused > 0)
{
data = p->payload + (p->payload_size - bytes_unused);
}
else
{
/* No more data */
return;
}
dnsSessionData->curr_rec_state = DNS_RESP_STATE_Q_NAME;
dnsSessionData->curr_rec = 0;
}
/* Print out the header (but only once -- when we're ready to parse the Questions */
#ifdef DEBUG
if ((dnsSessionData->curr_rec_state == DNS_RESP_STATE_Q_NAME) &&
(dnsSessionData->curr_rec == 0))
{
_dpd.debugMsg(DEBUG_DNS,
"DNS Header: length %d, id 0x%x, flags 0x%x, "
"questions %d, answers %d, authorities %d, additionals %d\n",
dnsSessionData->length, dnsSessionData->hdr.id,
dnsSessionData->hdr.flags, dnsSessionData->hdr.questions,
dnsSessionData->hdr.answers,
dnsSessionData->hdr.authorities,
dnsSessionData->hdr.additionals);
}
#endif
if (!(dnsSessionData->hdr.flags & DNS_HDR_FLAG_RESPONSE))
{
/* Not a response */
return;
}
/* Handle the DNS Queries */
if (dnsSessionData->state == DNS_RESP_STATE_QUESTION)
{
/* Skip over the 4 byte question records... */
for (i=dnsSessionData->curr_rec; i< dnsSessionData->hdr.questions; i++)
{
bytes_unused = ParseDNSQuestion(data, p->payload_size, bytes_unused, dnsSessionData);
if (dnsSessionData->curr_rec_state == DNS_RESP_STATE_Q_COMPLETE)
{
DEBUG_WRAP(
_dpd.debugMsg(DEBUG_DNS,
"DNS Question %d: type %d, class %d\n",
i, dnsSessionData->curr_q.type,
dnsSessionData->curr_q.dns_class);
);
dnsSessionData->curr_rec_state = DNS_RESP_STATE_Q_NAME;
dnsSessionData->curr_rec++;
}
if (bytes_unused > 0)
{
data = p->payload + (p->payload_size - bytes_unused);
}
else
{
/* No more data */
return;
}
}
dnsSessionData->state = DNS_RESP_STATE_ANS_RR;
dnsSessionData->curr_rec_state = DNS_RESP_STATE_RR_NAME_SIZE;
dnsSessionData->curr_rec = 0;
}