All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.tid.pce.pcep.objects.IncludeRouteObject Maven / Gradle / Ivy

The newest version!
package es.tid.pce.pcep.objects;

import java.util.LinkedList;
import java.util.Vector;

import es.tid.pce.pcep.objects.subobjects.SREROSubobject;
import es.tid.rsvp.objects.subobjects.*;

/**
 * 

Include Route Object as described in RFC 5440

* *

From RFC 5440 Section 7.12. Include Route Object

The IRO (Include Route Object) is optional and can be used to specify that the computed path MUST traverse a set of specified network elements. The IRO MAY be carried within PCReq and PCRep messages. When carried within a PCRep message with the NO-PATH object, the IRO indicates the set of elements that cause the PCE to fail to find a path. IRO Object-Class is 10. IRO Object-Type is 1. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | // (Sub-objects) // | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 17: IRO Body Format Sub-objects: The IRO is made of sub-objects identical to the ones defined in [RFC3209], [RFC3473], and [RFC3477], where the IRO sub- object type is identical to the sub-object type defined in the related documents. The following sub-object types are supported. Type Sub-object 1 IPv4 prefix 2 IPv6 prefix 4 Unnumbered Interface ID 32 Autonomous system number The L bit of such sub-object has no meaning within an IRO. * @author ogondio * */ public class IncludeRouteObject extends PCEPObject{ private LinkedList IROList; public IncludeRouteObject(){ super(); this.setObjectClass(ObjectParameters.PCEP_OBJECT_CLASS_IRO); this.setOT(ObjectParameters.PCEP_OBJECT_TYPE_IRO); IROList = new LinkedList(); } /** * Constructs a new IRO (Include Route Object) from a sequence of bytes * @param bytes Sequence of bytes where the object is present * @param offset Position at which the object starts * @throws MalformedPCEPObjectException Thrown if the decoded object is not well formed */ public IncludeRouteObject(byte[] bytes, int offset)throws MalformedPCEPObjectException{ super(bytes,offset); IROList = new LinkedList(); decode(); } //Encode and Decode /** * Encode Explicit Route Object */ public void encode() { int len=4;//The four bytes of the header for (int k=0; k=ObjectLength){ fin=true; } } } //Getters and setters //FIXME: Ver si es mejor Vector o LInkedList, y A�ADIR MAS METODOS UTILES, estos son escasos. public void addIROSubobject(EROSubobject eroso){ IROList.add(eroso); } public void addEROSubobjectVector(Vector erosovec){ IROList.addAll(erosovec); } public LinkedList getIROList() { return IROList; } public void setIROList(LinkedList iROList) { IROList = iROList; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((IROList == null) ? 0 : IROList.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; IncludeRouteObject other = (IncludeRouteObject) obj; if (IROList == null) { if (other.IROList != null) return false; } else if (!IROList.equals(other.IROList)) return false; return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy