Search in sources :

Example 6 with Host

use of gov.nist.core.Host in project XobotOS by xamarin.

the class Via method setMAddr.

/**
     * Sets the value of the <code>maddr</code> parameter of this ViaHeader. The
     * maddr parameter indicates the server address to be contacted for this
     * user, overriding any address derived from the host field.
     *
     * @param  mAddr new value of the <code>maddr</code> parameter
     * @throws ParseException which signals that an error has been reached
     * unexpectedly while parsing the mAddr value.
     */
public void setMAddr(String mAddr) throws ParseException {
    if (mAddr == null)
        throw new NullPointerException("JAIN-SIP Exception, " + "Via, setMAddr(), the mAddr parameter is null.");
    Host host = new Host();
    host.setAddress(mAddr);
    NameValue nameValue = new NameValue(ParameterNames.MADDR, host);
    setParameter(nameValue);
}
Also used : NameValue(gov.nist.core.NameValue) Host(gov.nist.core.Host)

Example 7 with Host

use of gov.nist.core.Host in project XobotOS by xamarin.

the class Via method setHost.

/**
     * Set the host part of this ViaHeader to the newly supplied <code>host</code>
     * parameter.
     *
     * @throws ParseException which signals that an error has been reached
     * unexpectedly while parsing the host value.
     */
public void setHost(String host) throws ParseException {
    if (sentBy == null)
        sentBy = new HostPort();
    try {
        Host h = new Host(host);
        sentBy.setHost(h);
    } catch (Exception e) {
        throw new NullPointerException(" host parameter is null");
    }
}
Also used : HostPort(gov.nist.core.HostPort) Host(gov.nist.core.Host) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException)

Example 8 with Host

use of gov.nist.core.Host in project XobotOS by xamarin.

the class MessageChannel method getViaHostPort.

/**
     * Get the via header host:port structure. This is extracted from the topmost via header of
     * the request.
     * 
     * @return a host:port structure
     */
public HostPort getViaHostPort() {
    HostPort retval = new HostPort();
    retval.setHost(new Host(this.getViaHost()));
    retval.setPort(this.getViaPort());
    return retval;
}
Also used : HostPort(gov.nist.core.HostPort) Host(gov.nist.core.Host)

Example 9 with Host

use of gov.nist.core.Host in project XobotOS by xamarin.

the class MessageChannel method getHostPort.

/**
     * Get the hostport structure of this message channel.
     */
public HostPort getHostPort() {
    HostPort retval = new HostPort();
    retval.setHost(new Host(this.getHost()));
    retval.setPort(this.getPort());
    return retval;
}
Also used : HostPort(gov.nist.core.HostPort) Host(gov.nist.core.Host)

Example 10 with Host

use of gov.nist.core.Host in project XobotOS by xamarin.

the class MessageProcessor method setSentBy.

/**
     * Set the sentby string. This is used for stamping outgoing messages sent
     * from this listening point.
     *
     * @param sentBy
     */
public void setSentBy(String sentBy) throws ParseException {
    int ind = sentBy.indexOf(":");
    if (ind == -1) {
        this.sentByHostPort = new HostPort();
        this.sentByHostPort.setHost(new Host(sentBy));
    } else {
        this.sentByHostPort = new HostPort();
        this.sentByHostPort.setHost(new Host(sentBy.substring(0, ind)));
        String portStr = sentBy.substring(ind + 1);
        try {
            int port = Integer.parseInt(portStr);
            this.sentByHostPort.setPort(port);
        } catch (NumberFormatException ex) {
            throw new ParseException("Bad format encountered at ", ind);
        }
    }
    this.sentBySet = true;
    this.sentBy = sentBy;
}
Also used : HostPort(gov.nist.core.HostPort) Host(gov.nist.core.Host) ParseException(java.text.ParseException)

Aggregations

Host (gov.nist.core.Host)12 HostPort (gov.nist.core.HostPort)9 ParseException (java.text.ParseException)3 InvalidArgumentException (javax.sip.InvalidArgumentException)2 NameValue (gov.nist.core.NameValue)1 Via (gov.nist.javax.sip.header.Via)1 SIPRequest (gov.nist.javax.sip.message.SIPRequest)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 Iterator (java.util.Iterator)1