/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* netflow method
*
* Glenn Fowler
* AT&T Research
*/
#include "flowlib.h"
{
CXV("dst_vlan", "number", NETFLOW_dst_vlan, "Virtual LAN identifier associated with egress interface.")
CXV("end", "ns_t", NETFLOW_end, "Flow end time in 64 bit nanoseconds since the epoch (synthesized).")
CXV("engine_type", "number", NETFLOW_engine_type, "Type of flow switching engine 0: RP, 1: VIP/linecard.")
CXV("flow_active_timeout", "number", NETFLOW_flow_active_timeout, "Timeout value (in seconds) for active flow cache entries.")
CXV("flow_inactive_timeout", "number", NETFLOW_flow_inactive_timeout, "Timeout value (in seconds) for inactive flow cache entries.")
CXV("forwarding_status", "number", NETFLOW_forwarding_status, "Forwarding status 0: unknown, 1: forwarded, 2: dropped, 3: consumed.")
CXV("icmp_type", "number", NETFLOW_icmp_type, "Internet Control Message Protocol packet type coded as ((type*256)+code).")
CXV("in_bytes", "number", NETFLOW_in_bytes, "Incoming counter for the number of bytes associated with an ip Flow.")
CXV("in_packets", "number", NETFLOW_in_packets, "Incoming counter for the number of packets associated with an ip Flow.")
CXV("ip_protocol_version", "number", NETFLOW_ip_protocol_version, "ip version 6: ipv6, 4 or not specified: ipv4.")
CXV("mpls_label_1", "number", NETFLOW_mpls_label_1, "Stack position 1 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_2", "number", NETFLOW_mpls_label_2, "Stack position 2 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_3", "number", NETFLOW_mpls_label_3, "Stack position 3 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_4", "number", NETFLOW_mpls_label_4, "Stack position 4 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_5", "number", NETFLOW_mpls_label_5, "Stack position 5 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_6", "number", NETFLOW_mpls_label_6, "Stack position 6 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_7", "number", NETFLOW_mpls_label_7, "Stack position 7 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_8", "number", NETFLOW_mpls_label_8, "Stack position 8 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_9", "number", NETFLOW_mpls_label_9, "Stack position 9 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_label_10", "number", NETFLOW_mpls_label_10, "Stack position 10 MPLS label: 20 bits MPLS label, 3 bits experimental, 1 bit end-of-stack.")
CXV("mpls_top_label_class", "number", NETFLOW_mpls_top_label_class, "Forwarding Equivalent Class corresponding to the MPLS Top Label.")
CXV("mpls_top_label_type", "number", NETFLOW_mpls_top_label_type, "MPLS top label type: 0x00 UNKNOWN 0x01 TE-MIDPT 0x02 ATOM 0x03 VPN 0x04 BGP 0x05 LDP.")
CXV("mul_igmp_type", "number", NETFLOW_mul_igmp_type, "Internet Group Management Protocol packet type coded.")
CXV("option_headers", "number", NETFLOW_option_headers, "Bit-encoded field identifying ipv6 option headers found in the flow.")
CXV("out_bytes", "number", NETFLOW_out_bytes, "Outgoing counter for the number of bytes associated with an ip Flow.")
CXV("out_packets", "number", NETFLOW_out_packets, "Outgoing counter for the number of packets associated with an ip Flow.")
CXV("src_vlan", "number", NETFLOW_src_vlan, "Virtual LAN identifier associated with ingress interface.")
CXV("start", "ns_t", NETFLOW_start, "Flow start time in 64 bit nanoseconds since the epoch (synthesized).")
CXV("tcp_misseq_cnt", "number", NETFLOW_tcp_misseq_cnt, "Number of mis-sequenced tcp packets (V1).")
CXV("tcp_retx_secs", "number", NETFLOW_tcp_retx_secs, "Number of seconds between mis-sequenced packets (V1).")
CXV("total_bytes_exp", "number", NETFLOW_total_bytes_exp, "The number of bytes exported by the observation domain.")
CXV("total_flows_exp", "number", NETFLOW_total_flows_exp, "The number of flows exported by the observation domain.")
CXV("total_packets_exp", "number", NETFLOW_total_packets_exp, "The number of packets exported by the observation domain.")
CXV("uptime", "elapsed_t", NETFLOW_uptime, "Elapsed milliseconds since the router booted (header).")
{0}
};
static int
op_get(Cx_t* cx, Cxinstruction_t* pc, Cxoperand_t* r, Cxoperand_t* a, Cxoperand_t* b, void* data, Cxdisc_t* disc)
{
{
{
case NETFLOW_BUFFER:
break;
case NETFLOW_NUMBER:
break;
default:
break;
}
return 0;
}
{
case NETFLOW_bytes:
break;
case NETFLOW_count:
break;
case NETFLOW_direction:
break;
case NETFLOW_dst_addr:
{
}
else
{
}
break;
case NETFLOW_dst_addrv4:
break;
case NETFLOW_dst_addrv6:
break;
case NETFLOW_dst_as:
break;
case NETFLOW_dst_as16:
break;
case NETFLOW_dst_as32:
break;
case NETFLOW_dst_mask:
break;
case NETFLOW_dst_maskv4:
break;
case NETFLOW_dst_maskv6:
break;
case NETFLOW_dst_port:
break;
case NETFLOW_dst_prefix:
{
}
else
{
}
break;
case NETFLOW_dst_prefixv4:
break;
case NETFLOW_dst_prefixv6:
break;
case NETFLOW_dst_tos:
break;
case NETFLOW_dst_vlan:
break;
case NETFLOW_end:
#if _typ_int64_t
#else
#endif
break;
case NETFLOW_engine_id:
break;
case NETFLOW_engine_type:
break;
case NETFLOW_first:
break;
case NETFLOW_flags:
break;
break;
break;
case NETFLOW_flow_label:
break;
break;
case NETFLOW_flow_sequence:
break;
case NETFLOW_flows:
break;
case NETFLOW_forwarding_code:
break;
break;
case NETFLOW_fragment_offset:
break;
case NETFLOW_hop:
{
}
else
{
}
break;
case NETFLOW_hopv4:
break;
case NETFLOW_hopv6:
break;
case NETFLOW_ident:
break;
case NETFLOW_icmp_type:
break;
case NETFLOW_if_desc:
break;
case NETFLOW_if_name:
break;
case NETFLOW_in_bytes:
break;
case NETFLOW_in_dst_mac:
break;
break;
break;
case NETFLOW_in_packets:
break;
case NETFLOW_in_src_mac:
break;
case NETFLOW_input_snmp:
break;
break;
case NETFLOW_last:
break;
break;
case NETFLOW_max_ttl:
break;
break;
case NETFLOW_min_ttl:
break;
case NETFLOW_mpls_label_1:
break;
case NETFLOW_mpls_label_2:
break;
case NETFLOW_mpls_label_3:
break;
case NETFLOW_mpls_label_4:
break;
case NETFLOW_mpls_label_5:
break;
case NETFLOW_mpls_label_6:
break;
case NETFLOW_mpls_label_7:
break;
case NETFLOW_mpls_label_8:
break;
case NETFLOW_mpls_label_9:
break;
case NETFLOW_mpls_label_10:
break;
break;
break;
case NETFLOW_mul_dst_bytes:
break;
case NETFLOW_mul_dst_packets:
break;
case NETFLOW_mul_igmp_type:
break;
case NETFLOW_nsec:
break;
case NETFLOW_option_headers:
break;
case NETFLOW_out_bytes:
break;
case NETFLOW_out_dst_mac:
break;
case NETFLOW_out_packets:
break;
case NETFLOW_out_src_mac:
break;
case NETFLOW_output_snmp:
break;
case NETFLOW_packets:
break;
case NETFLOW_protocol:
break;
case NETFLOW_router_sc:
{
}
else
{
}
break;
case NETFLOW_router_scv4:
break;
case NETFLOW_router_scv6:
break;
break;
case NETFLOW_sampler_interval:
break;
case NETFLOW_sampler_mode:
break;
case NETFLOW_sampler_name:
break;
case NETFLOW_src_addr:
{
}
else
{
}
break;
case NETFLOW_src_addrv4:
break;
case NETFLOW_src_addrv6:
break;
case NETFLOW_src_as:
break;
case NETFLOW_src_as16:
break;
case NETFLOW_src_as32:
break;
case NETFLOW_src_mask:
break;
case NETFLOW_src_maskv4:
break;
case NETFLOW_src_maskv6:
break;
case NETFLOW_src_port:
break;
case NETFLOW_src_prefix:
{
}
else
{
}
break;
case NETFLOW_src_prefixv4:
break;
case NETFLOW_src_prefixv6:
break;
case NETFLOW_src_tos:
break;
case NETFLOW_src_vlan:
break;
case NETFLOW_start:
#if _typ_int64_t
#else
#endif
break;
case NETFLOW_tcp_flags:
break;
case NETFLOW_tcp_misseq_cnt:
break;
case NETFLOW_tcp_retx_cnt:
break;
case NETFLOW_tcp_retx_secs:
break;
case NETFLOW_time:
break;
case NETFLOW_tos:
break;
case NETFLOW_total_bytes_exp:
break;
case NETFLOW_total_flows_exp:
break;
break;
case NETFLOW_uptime:
break;
case NETFLOW_vendor_43:
break;
case NETFLOW_vendor_51:
break;
case NETFLOW_vendor_65:
break;
case NETFLOW_vendor_66:
break;
case NETFLOW_vendor_67:
break;
case NETFLOW_vendor_68:
break;
case NETFLOW_vendor_69:
break;
case NETFLOW_vendor_87:
break;
case NETFLOW_version:
break;
default:
(*disc->errorf)(cx, disc, ERROR_PANIC, "%s: variable index %d not implemented", vp->name, vp->index);
return -1;
}
return 0;
}
{
};
/*
* methf
*/
extern Dsslib_t dss_lib_netflow;
static Dssmeth_t*
netflowmeth(const char* name, const char* options, const char* schema, Dssdisc_t* disc, Dssmeth_t* meth)
{
char* s;
int i;
for (i = 0; i < elementsof(local_callouts); i++)
return 0;
return 0;
if (options)
{
return 0;
for (;;)
{
{
case '?':
return 0;
case ':':
return 0;
}
break;
}
}
return meth;
}
/*
* NOTE: template.field[] order, NETFLOW_* and Netflow_t must all match
*/
{
0,
0,
0,
0,
0,
0,
{
NUMBER(in_packets, 0),
NUMBER(src_maskv4, 0),
NUMBER(input_snmp, 0),
NUMBER(dst_maskv4, 0),
NUMBER(output_snmp, 0),
NUMBER(mul_dst_packets, 0),
NUMBER(mul_dst_bytes, 0),
NUMBER(out_packets, 0),
NUMBER(min_packet_length, 0),
NUMBER(max_packet_length, 0),
NUMBER(src_maskv6, 0),
NUMBER(dst_maskv6, 0),
NUMBER(flow_label, 0),
NUMBER(mul_igmp_type, 0),
NUMBER(sampler_interval, 0),
NUMBER(sampler_algorithm, 0),
NUMBER(engine_type, 0),
NUMBER(total_bytes_exp, 0),
NUMBER(total_packets_exp, 0),
NUMBER(total_flows_exp, 0),
NUMBER(sampler_id, 0),
NUMBER(sampler_mode, 0),
NUMBER(ident, 0),
NUMBER(in_src_mac, 0),
NUMBER(out_dst_mac, 0),
NUMBER(option_headers, 0),
NUMBER(mpls_label_1, 0),
NUMBER(mpls_label_2, 0),
NUMBER(mpls_label_3, 0),
NUMBER(mpls_label_4, 0),
NUMBER(mpls_label_5, 0),
NUMBER(mpls_label_6, 0),
NUMBER(mpls_label_7, 0),
NUMBER(mpls_label_8, 0),
NUMBER(mpls_label_9, 0),
NUMBER(mpls_label_10, 0),
NUMBER(in_dst_mac, 0),
NUMBER(out_src_mac, 0),
BUFFER(sampler_name, 0),
NUMBER(in_permanent_bytes, 0),
NUMBER(fragment_offset, 0),
NUMBER(forwarding_status, 0),
}
};
/*
* openf
*/
static int
{
{
if (flow)
return -1;
}
return 0;
}
{
"netflow",
"Cisco router netflow dump data",
CXH,
0,
0,
"%(time:%+u%K)s %(prot)d %(src_addr)s:%(src_port)d %(dst_addr)s:%(dst_port)d %(hop)s"
};
{
"netflow",
"netflow method"
"[-1ls5Pp0?\n@(#)$Id: dss netflow method (AT&T Research) 2010-02-02 $\n]"
CXH,
&libraries[0],
&method,
};