예제 #1
0
파일: icmp.c 프로젝트: krissg/junkie
static char const *icmp_info_2_str(struct proto_info const *info_)
{
    struct icmp_proto_info const *info = DOWNCAST(info_, info, icmp_proto_info);
    char *str = tempstr();
    snprintf(str, TEMPSTR_SIZE, "%s, type=%s, err=%s",
        proto_info_2_str(info_),
        icmp_type_2_str(info->type, info->code),
        info->set_values & ICMP_ERR_SET ? icmp_err_2_str(&info->err, info->set_values) : "NONE");

    return str;
}
예제 #2
0
// Not the same than ICMP(v4) since the error codes are different.
static char const *icmpv6_info_2_str(struct proto_info const *info_)
{
    struct icmp_proto_info const *info = DOWNCAST(info_, info, icmp_proto_info);
    char *str = tempstr();
    snprintf(str, TEMPSTR_SIZE, "%s, type=%s, code=%"PRIu8", err=%s, id=%d",
        proto_info_2_str(info_),
        icmpv6_type_2_str(info->type), info->code,
        info->set_values & ICMP_ERR_SET ? icmp_err_2_str(&info->err, info->set_values) : "NONE",
        info->set_values & ICMP_ID_SET ? info->id : -1);

    return str;
}