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

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

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

import java.util.LinkedList;

import es.tid.pce.pcep.PCEPProtocolViolationException;
import es.tid.pce.pcep.constructs.EndPoint;
import es.tid.pce.pcep.constructs.EndPointAndRestrictions;
import es.tid.pce.pcep.constructs.EndpointRestriction;
import es.tid.pce.pcep.constructs.IPv4AddressEndPoint;
import es.tid.pce.pcep.constructs.UnnumIfEndPoint;
import es.tid.pce.pcep.objects.tlvs.EndPointIPv4TLV;
import es.tid.pce.pcep.objects.tlvs.PCEPTLV;
import es.tid.pce.pcep.objects.tlvs.UnnumberedEndpointTLV;

/**
 * GeneralizedEndPoints Object of Type P2P End Points
 * @author ogondio
 *
 */
public class P2MPGeneralizedEndPoints extends GeneralizedEndPoints {
	
	private EndPointAndRestrictions EndpointAndRestrictions;
	private LinkedList  EndpointAndRestrictionsList;

	public P2MPGeneralizedEndPoints() {
		super();
		this.setGeneralizedEndPointsType(1);		
		EndpointAndRestrictionsList= new LinkedList ();
	}

	public P2MPGeneralizedEndPoints(byte[] bytes, int offset)
			throws MalformedPCEPObjectException, PCEPProtocolViolationException {
		super(bytes, offset);
		EndpointAndRestrictionsList= new LinkedList ();
		decode();
	}
	
	public void encode() {
		try {
			int len=8;
			if (EndpointAndRestrictionsList.size()>0){
				for (int i=0;i=max_offset){
				log.warn("Empty P2MPEndpoints !!!");
				throw new PCEPProtocolViolationException();
			}
			
			EndpointAndRestrictions = new EndPointAndRestrictions(this.object_bytes, offset);
			offset = offset + EndpointAndRestrictions.getLength();
			
			while (offset < max_offset)
			{
				EndPointAndRestrictions EndpointAndRestrictions = new EndPointAndRestrictions(this.object_bytes, offset);
				EndpointAndRestrictionsList.add(EndpointAndRestrictions);
				offset = offset + EndpointAndRestrictions.getLength();
			}
		} catch (PCEPProtocolViolationException e) {
			// TODO Auto-generated catch block
			throw new MalformedPCEPObjectException();
		}
		
	}

	public EndPointAndRestrictions getEndpointAndRestrictions() {
		return EndpointAndRestrictions;
	}

	public void setEndpointAndRestrictions(EndPointAndRestrictions endpointAndRestrictions) {
		EndpointAndRestrictions = endpointAndRestrictions;
	}

	public LinkedList getEndpointAndRestrictionsList() {
		return EndpointAndRestrictionsList;
	}

	public void setEndpointAndRestrictionsList(LinkedList endpointAndRestrictionsList) {
		EndpointAndRestrictionsList = endpointAndRestrictionsList;
	}
	



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy