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

io.pkts.packet.sip.header.RecordRouteHeader Maven / Gradle / Ivy

There is a newer version: 3.0.10
Show newest version
/**
 * 
 */
package io.pkts.packet.sip.header;

import io.pkts.buffer.Buffer;
import io.pkts.buffer.Buffers;
import io.pkts.packet.sip.SipParseException;
import io.pkts.packet.sip.address.Address;
import io.pkts.packet.sip.header.impl.ParametersSupport;
import io.pkts.packet.sip.header.impl.RecordRouteHeaderImpl;

/**
 * 
 * Source: RFC 3261 section 20.30
 * 
 * 

* The Record-Route header field is inserted by proxies in a request to force * future requests in the dialog to be routed through the proxy. *

* *

* Examples of its use with the Route header field are described in Sections * 16.12.1. *

*

* Example: * *

 *    Record-Route: <sip:server10.biloxi.com;lr>,
 *                  <sip:bigbox3.site3.atlanta.com;lr>
 * 
* *

* * @author [email protected] */ public interface RecordRouteHeader extends AddressParametersHeader { Buffer NAME = Buffers.wrap("Record-Route"); @Override RecordRouteHeader clone(); /** * Frame the value as a {@link RecordRouteHeader}. * * @param value * @return * @throws SipParseException in case anything goes wrong while parsing. */ static RecordRouteHeader frame(final Buffer buffer) throws SipParseException { final Buffer original = buffer.slice(); final Object[] result = AddressParametersHeader.frame(buffer); return new RecordRouteHeaderImpl(original, (Address) result[0], (Buffer) result[1]); } @Override Builder copy(); @Override default boolean isRecordRouteHeader() { return true; } @Override default RecordRouteHeader toRecordRouteHeader() { return this; } static Builder withUser(final Buffer user) { final Builder b = new Builder(); b.withUser(user); return b; } static Builder withUser(final String user) { return withUser(Buffers.wrap(user)); } static Builder withHost(final Buffer host) { final Builder b = new Builder(); b.withHost(host); return b; } static Builder withHost(final String host) { return withHost(Buffers.wrap(host)); } static Builder withAddress(final Address address) throws SipParseException { final Builder builder = new Builder(); builder.withAddress(address); return builder; } class Builder extends AddressParametersHeader.Builder { private Builder(ParametersSupport params) { super(NAME, params); } private Builder() { super(NAME); } @Override public RecordRouteHeader internalBuild(final Buffer rawValue, final Address address, final Buffer params) throws SipParseException { return new RecordRouteHeaderImpl(rawValue, address, params); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy