예제 #1
0
파일: eth.c 프로젝트: bsmr-c-cpp/junkie
static char const *eth_info_2_str(struct proto_info const *info_)
{
    struct eth_proto_info const *info = DOWNCAST(info_, info, eth_proto_info);
    char *str = tempstr();
    snprintf(str, TEMPSTR_SIZE, "%s, vlan_id=%d, source=%s, dest=%s, proto=%s",
        proto_info_2_str(info_),
        info->vlan_id,
        eth_addr_2_str(info->addr[0]),
        eth_addr_2_str(info->addr[1]),
        eth_proto_2_str(info->protocol));
    return str;
}
예제 #2
0
파일: dhcp.c 프로젝트: bonnefoa/junkie
static char const *dhcp_info_2_str(struct proto_info const *info_)
{
    struct dhcp_proto_info const *info = DOWNCAST(info_, info, dhcp_proto_info);
    char *str = tempstr();
    snprintf(str, TEMPSTR_SIZE, "%s, opcode=%s, msg_type=%s, xid=0x%x, client_ip=%s, client_mac=%s, server=%s",
        proto_info_2_str(info_),
        dhcp_opcode_2_str(info->opcode),
        dhcp_msg_type_2_str(info->msg_type),
        info->xid,
        info->set_values & DHCP_CLIENT_SET     ? ip_addr_2_str(&info->client) : "unset",
        info->hw_addr_is_eth ? eth_addr_2_str(info->client_mac) : "not eth",
        info->server_name[0] != '\0' ? info->server_name : "unset");

    return str;
}