<schema xmlns:ipdr="http://www.ipdr.org/namespaces/ipdr">

<annotation>
<documentation>
This document defines a subset of the identified IPFIX data
  model as XML Schema elements and complexTypes.  This schema
  definition is compatable with the IPDR Service Definition 
  format, enabling flow information to be represented as XML
  or binary documents.  And defines the format used when streaming
  flow information to a recording system.
  </documentation>
</annotation>
<element name="sourceAddress" type="ipdr:ipV4Addr">
<annotation>
<documentation>
IPv4 source address taken from the packet header.
  </documentation>
</annotation>
</element>


<element name="sourceAddressV6" type="ipdr:ipV6Addr">
<annotation>
<documentation>
IPv6 source address taken from the packet header.
  </documentation>
</annotation>
</element>


<element name="destinationAddress" type="ipdr:ipV4Addr">
<annotation>
<documentation>
IPv4 destination address taken from the packet header.
  </documentation>
</annotation>
</element>


<element name="destinationAddressV6" type="ipdr:ipV6Addr">
<annotation>
<documentation>
IPv6 destination address taken from the packet header.
  </documentation>
</annotation>
</element>


<element name="protocolIdentifier" type="int"> <annotation>
<documentation>
Protocol number identified in the IP packet. 
   
   In the Internet Protocol version 4 (IPv4) [RFC791] there is a field,
   called "Protocol", to identify the next level protocol.  This is an 8
   bit field.  In Internet Protocol version 6 (IPv6) [RFC1883] this field
   is called the "Next Header" field.
   
   These numbers are administered by IANA.
  </documentation>
<appinfo>
<ipdr:reference>http://www.iana.org/assignments/protocol-numbers</ipdr:reference>
</appinfo>
</annotation>
</element>

<element name="sourcePort" type="int"> <annotation>
<documentation>
This information element is used to report  UDP source port [see 
   RFC 768] or TCP source port [see RFC 793] as taken from the IP 
   header.
  </documentation>
</annotation>
</element>

<element name="destinationPort" type="int"> <annotation>
<documentation>
This information element is used to report  UDP destination port 
   [see RFC 768] or TCP destination port [see RFC 793] as taken from 
   the IP header.
  </documentation>
</annotation>
</element> <element name="ingressPort" type="int"> <annotation>
<documentation>
The ifIndex where the packets for the flow are being received.  
   ifIndex is defined by RFC 2233.
  </documentation>
</annotation>
</element>

<element name="egressPort" type="int"> <annotation>
<documentation>
The ifIndex where the packets for the flow are exiting. ifIndex is 
   defined by RFC 2233.
  </documentation>
</annotation>
</element>

<element name="packetCount" type="int"> <annotation>
<documentation>
Contains the count of packets sent and received associated with 
   the identified flow. 

   The packet count can be for packets received (towards source) or 
   packets sent (towards destination) or both (bi-directional flow).

   The packet count can be a running counter and is the count from 
   the beginning of the flow establishment.

   The packet count can be a delta counter and is the count since the 
   last report for this flow.
  </documentation>
<appinfo>
<ipdr:units>packets</ipdr:units>
</appinfo>
</annotation>
</element>

<element name="byteCount" type="int"> <annotation>
<documentation>
Contains the count of octets sent and received associated with the 
   identified flow. 

   The byte count can be for bytes received (towards source) or bytes 
   sent (towards destination) or both (bi-directional flow).

   The byte count can be a running counter and is the count from the 
   beginning of the flow establishment.

   The byte count can be a delta counter and is the count since the 
   last report for this flow.
  </documentation>
<appinfo>
<ipdr:units>bytes</ipdr:units>
</appinfo>
</annotation>
</element>

<element name="classOfService" type="int"> <annotation>
<documentation>
The class of service associated with a flow. 

   Class of Service Received
   Class of Service Transmitted

      1. IPv4, CoS value is defined by ToS in RFC 791
      2. IPv6, CoS value is defined by Traffic Class in RFC 2460
      3. MPLS, CoS value is defined by Exp in RFC 3032
      4. VLAN, CoS value is defined by user_priority in
         IEEE802.1q[802.1q] and IEEE 802.1p[802.1p]
  </documentation>
</annotation>
</element> <element name="flowLabel" type="int">
<annotation>
<documentation>
The Flow Label information element contains the IPV6 Flow Label 
   information as defined by RFC 2460. 
  </documentation>
</annotation>
</element> <element name="flowCreationTime" type="dateTime">
<annotation>
<documentation>
The timestamp of the first packet of the flow.
  </documentation>
</annotation>
</element>


<element name="flowEndTime" type="dateTime">
<annotation>
<documentation>
The timestamp of the last packet of the flow.. 
  </documentation>
</annotation>
</element>

<element name="sourceAS" type="int">
<annotation>
<documentation>
The Autonomous System (AS) numbers for the source address 
   associated with a flow. Autonomous System (AS) number is defined 
   by RFC 1930 and RFC 1771 (BGP-4):
  </documentation>
</annotation>
</element>

<element name="destinationAS" type="int"> <annotation>
<documentation>
The Autonomous System (AS) numbers for the destination address 
   associated wit a flow. Autonomous System (AS) number is defined by 
   RFC 1930 and RFC 1771 (BGP-4).
  </documentation>
</annotation>
</element>

<element name="nextHopAS" type="int"> <annotation>
<documentation>
The Autonomous System (AS) numbers for the next hop IP. Autonomous 
   System (AS) number is defined by RFC 1930 and RFC 1771 (BGP-4).
  </documentation>
</annotation>
</element>

<element name="tcpControlBits" type="int"> <annotation>
<documentation>
The TCP control bits seen for this flow. Note a 0 value for each 
   bit only indicates that the flag was not detected (i.e. it may 
   have occurred but was not detected by the reporting CCE). TCP 
   Control Bits are defined by RFC 793. 
  </documentation>
</annotation>
</element>

<element name="sourceExporterAddress" type="ipdr:ipV4Addr"> <annotation>
<documentation>
Source Exporter address is the address of the Exporter reporting 
   the flow, Address is same as is as shown for Source Address. This 
   information is used by applications to later correlate the 
   ingress/egress port with a specific Exporter. It is also used to 
   maintain the source Exporter information when there is an 
   intermediate proxy. For example, given the picture below:
   
               SW1 --------    P1 ------ Collector
                               ^
                               |
               SW2----------   |
   
   Flows coming from SW1 and SW2 through proxy P1 would look to the 
   Collector [ is this the right term??? PAC]  like the same Exporter 
   connection. With the Source Exporter in the message the original 
   Exporter  address is maintained.
  </documentation>
</annotation>
</element>

<element name="droppedPacketCount" type="int"> <annotation>
<documentation>
Contains the count of packets dropped at the observation point 
   associated with the identified flow. 

   The dropped packet count can be a running counter and is the count 
   from the beginning of the flow establishment.

   The dropped packet count can be a delta counter and is the count 
   since the last report for this flow.
  </documentation>
<appinfo>
<ipdr:units>packets</ipdr:units>
</appinfo>
</annotation>
</element>

<element name="samplingInterval" type="int">
<annotation>
<documentation>
When using Sampling, the rate at which packets is sampled. For      
   example, a value of 100 indicates that one of every hundred 
   packets is sampled.
  </documentation>
</annotation>
</element>

<element name="samplingAlgorithm" type="int">
<annotation>
<documentation>
The type of algorithm used for sampling data. Currently, the only 
   sampling algorithm defined  is:
   0x02 packet-sampling
  </documentation>
</annotation>
</element>

<element name="flowEndState" type="int"> <annotation>
<documentation>
The reason the flow has ended.
        1. Inactivity timeout
        2. End of flow detected (e.g. TCP FIN)
        3. Forced end ????
        4. Cache full
        
   [enumerations in IPDR service def schemas are recommended to be
    of form string, w/ integer values (for Compact format)
    defined via annotation]
  </documentation>
</annotation>
</element>

<element name="droppedByteCount" type="int"> <annotation>
<documentation>
Contains the count of octets dropped at the observation point 
   associated with the identified flow. 

   The dropped byte count can be a running counter and is the count 
   from the beginning of the flow establishment.

   The byte count can be a delta counter and is the count since the 
   last report for this flow.
  </documentation>
<appinfo>
<ipdr:units>bytes</ipdr:units>
</appinfo>
</annotation>
</element>

<complexType name="SimpleV4Flow">
<extension base="ipdr:IPDR">
<sequence>
<element ref="sourceAddress" minOccurs="1"/>
<element ref="destinationAddress" minOccurs="1"/>
<element ref="protocolIdentifier" minOccurs="1"/>
<element ref="sourcePort" minOccurs="1"/>
<element ref="destinationPort" minOccurs="1"/>
<element ref="ingressPort" minOccurs="1"/>
<element ref="egressPort" minOccurs="1"/>
<element ref="packetCount" minOccurs="1"/>
<element ref="byteCount" minOccurs="1"/>
<element ref="classOfService" minOccurs="0"/>
<element ref="flowLabel" minOccurs="0"/>
<element ref="flowCreationTime" minOccurs="1"/>
<element ref="flowEndTime" minOccurs="1"/>
<element ref="tcpControlBits" minOccurs="0"/>
<element ref="samplingInterval" minOccurs="0"/>
<element ref="samplingAlgorithm" minOccurs="0"/>
<element ref="sourceExporterAddress" minOccurs="1"/>
</sequence>
</extension>
</complexType>

<complexType name="SimpleV6Flow">
<extension base="ipdr:IPDR">
<sequence>
<element ref="sourceAddressV6" minOccurs="1"/>
<element ref="destinationAddressV6" minOccurs="1"/>
<element ref="protocolIdentifier" minOccurs="1"/>
<element ref="sourcePort" minOccurs="1"/>
<element ref="destinationPort" minOccurs="1"/>
<element ref="ingressPort" minOccurs="1"/>
<element ref="egressPort" minOccurs="1"/>
<element ref="packetCount" minOccurs="1"/>
<element ref="byteCount" minOccurs="1"/>
<element ref="classOfService" minOccurs="0"/>
<element ref="flowLabel" minOccurs="0"/>
<element ref="flowCreationTime" minOccurs="1"/>
<element ref="flowEndTime" minOccurs="1"/>
<element ref="tcpControlBits" minOccurs="0"/>
<element ref="samplingInterval" minOccurs="0"/>
<element ref="samplingAlgorithm" minOccurs="0"/>
<element ref="sourceExporterAddress" minOccurs="1"/>
</sequence>
</extension>
</complexType>

</schema>


