const uint16_t offlg = fragh->off();
TextLog_Print(text_log, "Next:0x%02X Off:%u ID:%u",
- fragh->ip6f_nxt, offlg, fragh->id());
+ static_cast<uint8_t>(fragh->ip6f_nxt), offlg, fragh->id());
if (fragh->mf())
TextLog_Puts(text_log, " MF");
TextLog_Print(text_log, "version:%u flags:0x%02X ethertype:(0x%04X)",
greh->get_version(), greh->flags,
- greh->proto());
+ static_cast<uint16_t>(greh->proto()));
}
//-------------------------------------------------------------------------
const uint16_t /*lyr_len*/)
{
const icmp::Icmp6Hdr* const icmph = reinterpret_cast<const icmp::Icmp6Hdr*>(raw_pkt);
- TextLog_Print(text_log, "sType:%d Code:%d ", icmph->type, icmph->code);
+ TextLog_Print(text_log, "sType:%d Code:%d ", icmph->type, static_cast<uint8_t>(icmph->code));
}
/******************************************************************
bool mf_set = false;
TextLog_Print(text_log, "Next:0x%02X TTL:%u TOS:0x%X ID:%u IpLen:%u DgmLen:%u",
- ip4h->proto(), ip4h->ttl(), ip4h->tos(),
+ static_cast<uint8_t>(ip4h->proto()), ip4h->ttl(), ip4h->tos(),
ip4h->id(), hlen, len);
/* print the reserved bit if it's set */
TextLog_Putc(text_log, '\t');
TextLog_Print(text_log, "Next:0x%02X TTL:%u TOS:0x%X DgmLen:%u",
- ip6h->next(), ip6h->hop_lim(), ip6h->tos(),
+ static_cast<uint8_t>(ip6h->next()), ip6h->hop_lim(), ip6h->tos(),
ip6h->len());
}
TextLog_Print(text_log, "Next:%s(%02X) TTL:%u TOS:0x%X ID:%u IpLen:%u DgmLen:%u",
PacketManager::get_proto_name(ip4h->proto()),
- ip4h->proto(), ip4h->ttl(), ip4h->tos(),
+ static_cast<uint8_t>(ip4h->proto()), ip4h->ttl(), ip4h->tos(),
ip4h->id(), hlen, len);
/* print the reserved bit if it's set */
{
TextLog_Print(text_log, "Protocol:%s(%02X)",
PacketManager::get_proto_name(ip4h->proto()),
- ip4h->proto());
+ static_cast<uint8_t>(ip4h->proto()));
break;
}
}
TextLog_Print(text_log, " ORG:0x%02X%02X%02X PROTO:0x%04X",
other->org_code[0], other->org_code[1], other->org_code[2],
- proto);
+ static_cast<uint16_t>(proto));
}
}
const ProtocolId prot_id = eh->ethertype();
if (to_utype(prot_id) <= to_utype(ProtocolId::ETHERTYPE_MINIMUM))
- TextLog_Print(text_log, " len:0x%04X", prot_id);
+ TextLog_Print(text_log, " len:0x%04X", static_cast<uint16_t>(prot_id));
else
- TextLog_Print(text_log, " type:0x%04X", prot_id);
+ TextLog_Print(text_log, " type:0x%04X", static_cast<uint16_t>(prot_id));
}
//-------------------------------------------------------------------------
uint64_t fsize = file->get_file_size();
if ( fsize > 0)
- TextLog_Print(tlog, "[Size: %lu] ", fsize);
+ TextLog_Print(tlog, "[Size: %" PRIu64 "] ", fsize);
TextLog_Print(tlog, "\n");
return;
TextLog_Print(log, "GRE version:%u flags:0x%02X ether-type:0x%04X\n",
- greh->get_version(), greh->flags, greh->proto());
+ greh->get_version(), greh->flags, static_cast<uint16_t>(greh->proto()));
}
/*--------------------------------------------------------------------
default:
// the only cases where op.len is invalid were handled aboved
// op.len includes code and length bytes but data does not
- TextLog_Print(log, "Type %u, Len %u", op.code, op.len);
+ TextLog_Print(log, "Type %u, Len %u", static_cast<uint8_t>(op.code), op.len);
if ( op.len <= 2 )
break;
break;
default:
- TextLog_Print(log, " Kind %u, Len %u", opt.code, opt.len);
+ TextLog_Print(log, " Kind %u, Len %u", static_cast<uint8_t>(opt.code), opt.len);
if ( opt.len <= 2 )
break;
LogIPHeader(log, orig);
TextLog_Print(log, "Protocol: 0x%X (unknown or "
- "header truncated)", orig->ptrs.ip_api.proto());
+ "header truncated)", static_cast<uint8_t>(orig->ptrs.ip_api.proto()));
break;
}
} /* switch */
SO_PUBLIC bool TextLog_Putc(TextLog* const, char);
SO_PUBLIC bool TextLog_Quote(TextLog* const, const char*);
SO_PUBLIC bool TextLog_Write(TextLog* const, const char*, int len);
-SO_PUBLIC bool TextLog_Print(TextLog* const, const char* format, ...);
+SO_PUBLIC bool TextLog_Print(TextLog* const, const char* format, ...) __attribute__((format (printf, 2, 3)));
SO_PUBLIC bool TextLog_Flush(TextLog* const);
SO_PUBLIC int TextLog_Avail(TextLog* const);
static void ff_flowstart_time(const Args& a)
{
if (a.pkt->flow)
- TextLog_Print(csv_log, "%lu", a.pkt->flow->flowstats.start_time.tv_sec);
+ TextLog_Print(csv_log, "%ld", a.pkt->flow->flowstats.start_time.tv_sec);
}
static void ff_gid(const Args& a)
static void ff_seconds(const Args& a)
{
- TextLog_Print(csv_log, "%lu", a.pkt->pkth->ts.tv_sec);
+ TextLog_Print(csv_log, "%ld", a.pkt->pkth->ts.tv_sec);
}
static void ff_server_bytes(const Args& a)
if (a.pkt->flow)
{
print_label(a, "flowstart_time");
- TextLog_Print(json_log, "%lu", a.pkt->flow->flowstats.start_time.tv_sec);
+ TextLog_Print(json_log, "%ld", a.pkt->flow->flowstats.start_time.tv_sec);
return true;
}
return false;
static bool ff_seconds(const Args& a)
{
print_label(a, "seconds");
- TextLog_Print(json_log, "%lu", a.pkt->pkth->ts.tv_sec);
+ TextLog_Print(json_log, "%ld", a.pkt->pkth->ts.tv_sec);
return true;
}
src.ntop(shost, sizeof(shost));
dst.ntop(dhost, sizeof(dhost));
- int vlan_tag = fs->vlan_tag == 0xfff ? 0 : fs->vlan_tag;
+ uint16_t vlan_tag = (fs->vlan_tag == 0xfff) ? 0 : fs->vlan_tag;
TextLog_Print(hext_log,
- "\n$%s %hd %hd %d %d %s %d %s %d %u %lu %lu %lu %lu %lu %lu %d %lu %lu %d %hd %d\n",
+ "\n$%s " // type (sof or eof)
+ "%hd " // ingressGroup
+ "%hd " // egressGroup
+ "%d " // ingressIntf
+ "%d " // egressIntf
+ "%s " // initiatorIp (stringified)
+ "%d " // initiatorPort (host order)
+ "%s " // responderIp (stringified)
+ "%d " // responderPort (host order)
+ "%u " // opaque
+ "%" PRIu64 " " // initiatorPkts
+ "%" PRIu64 " " // responderPkts
+ "%" PRIu64 " " // initiatorPktsDropped
+ "%" PRIu64 " " // responderPktsDropped
+ "%" PRIu64 " " // initiatorBytesDropped
+ "%" PRIu64 " " // responderBytesDropped
+ "%hhu " // isQoSAppliedOnSrcIntf
+ "%ld " // sof_timestamp.tv_sec
+ "%ld " // eof_timestamp.tv_sec
+ "%hu " // vlan_tag
+ "%hu " // address_space_id
+ "%hhu" // protocol
+ "\n",
cmd,
fs->ingressGroup,
fs->egressGroup,