2 * Copyright (c) 2003 University of Murcia. All rights reserved.
3 * --------------------------------------------------------------
4 * For more information, please see <http://www.umu.euro6ix.org/>.
7 package org.umu.cops.stack;
9 import org.umu.cops.stack.COPSObjHeader.CNum;
10 import org.umu.cops.stack.COPSObjHeader.CType;
13 * COPS IPv6 Input Address (RFC 2748)
15 * The In-Interface Object is used to identify the incoming interface on
16 * which a particular request applies and the address where the received
17 * message originated. For flows or messages generated from the PEP's
18 * local host, the loop back address and ifindex are used.
20 * This Interface object is also used to identify the incoming
21 * (receiving) interface via its ifindex. The ifindex may be used to
22 * differentiate between sub-interfaces and unnumbered interfaces (see
23 * RSVP's LIH for an example). When SNMP is supported by the PEP, this
24 * ifindex integer MUST correspond to the same integer value for the
25 * interface in the SNMP MIB-II interface index table.
27 * Note: The ifindex specified in the In-Interface is typically relative
28 * to the flow of the underlying protocol messages. The ifindex is the
29 * interface on which the protocol message was received.
31 * C-Type = 2, IPv6 Address + Interface
34 * +--------------+--------------+--------------+--------------+
38 * + IPv6 Address format +
42 * +--------------+--------------+--------------+--------------+
44 * +--------------+--------------+--------------+--------------+
46 * For this type of the interface object, the IPv6 address specifies the
47 * IP address that the incoming message came from. The ifindex is used
48 * to refer to the MIB-II defined local incoming interface on the PEP as
51 public class COPSIpv6InInterface extends COPSIpv6Interface {
54 * Constructor generally used for sending messages
55 * @param ifindex - the interface value
56 * @param addr - the IPv6 address
57 * @throws java.lang.IllegalArgumentException
59 public COPSIpv6InInterface(final COPSIpv6Address addr, final int ifindex) {
60 super(new COPSObjHeader(CNum.ININTF, CType.STATELESS), addr, ifindex);
64 * Constructor generally used when parsing the bytes of an inbound COPS message but can also be used when the
65 * COPSObjHeader information is known
66 * @param objHdr - the object header
67 * @param ifindex - the interface value
68 * @param addr - the IPv6 address
69 * @throws java.lang.IllegalArgumentException
71 protected COPSIpv6InInterface(final COPSObjHeader objHdr, final COPSIpv6Address addr, final int ifindex) {
72 super(objHdr, addr, ifindex);
73 if (!objHdr.getCNum().equals(CNum.ININTF))
74 throw new IllegalArgumentException("CNum must be of type - " + CNum.ININTF);
75 if (!objHdr.getCType().equals(CType.STATELESS))
76 throw new IllegalArgumentException("CType must be of type - " + CType.STATELESS);
80 * Creates this object from a byte array
81 * @param objHdrData - the header
82 * @param dataPtr - the data to parse
83 * @return - a new Timer
84 * @throws java.lang.IllegalArgumentException
86 public static COPSIpv6InInterface parse(final COPSObjHeaderData objHdrData, final byte[] dataPtr) {
87 return new COPSIpv6InInterface(objHdrData.header, COPSIpv6Interface.parseAddress(dataPtr),
88 COPSIpv6Interface.parseIfIndex(dataPtr));
91 public boolean isInInterface() { return true; }