Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.mediaproxy
Class DynamicAddressChannel

    java.lang.Object
      org.jivesoftware.openfire.mediaproxy.DynamicAddressChannel

All Implemented Interfaces:
  Runnable, DatagramListener

    public class DynamicAddressChannel

extends Object
implements Runnable, DatagramListener

Listen packets from defined dataSocket and send packets to the defined host. But also provides a mechanism to dynamic bind host and port implementing DatagramListener methods to change the host and port values according to the received packets.

Author:
  Thiago Camargo

Field Summary
`protected byte[]` | `buf`
`protected DatagramSocket` | `dataSocket`
`protected boolean` | `enabled`
`protected InetAddress` | `host`
`protected DatagramPacket` | `packet`
`protected int` | `port`

Constructor Summary
`DynamicAddressChannel(DatagramSocket dataSocket, InetAddress host, int port)` Default Channel Constructor

Method Summary
`void` | `addListener(DatagramListener datagramListener)` Adds a DatagramListener to the Channel
`void` | `cancel()`
`boolean` | `datagramReceived(DatagramPacket datagramPacket)` Implement DatagramListener method.
`InetAddress` | `getHost()` Get the host that the packet will be sent to.
`int` | `getPort()` Get the port that the packet will be sent to.
`void` | `relayPacket(DatagramPacket packet)`
`void` | `removeListener(DatagramListener datagramListener)` Remove a DatagramListener from the Channel
`void` | `removeListeners()` Remove every Listeners
`void` | `run()` Thread override method
`protected void` | `setHost(InetAddress host)` Set the host that the packet will be sent to.
`protected void` | `setPort(int port)` Set the port that the packet will be sent to.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.lang.Runnable
`run`

Field Detail

### buf

    protected byte[] buf

### dataSocket

    protected DatagramSocket dataSocket

### packet

    protected DatagramPacket packet

### enabled

    protected boolean enabled

### host

    protected InetAddress host

### port

    protected int port

Constructor Detail

### DynamicAddressChannel

    public DynamicAddressChannel(DatagramSocket dataSocket,
                                 InetAddress host,
                                 int port)

  Default Channel Constructor

  Parameters:
    `dataSocket` - datasocket to used to send and receive packets
    `host` - default destination host for received packets
    `port` - default destination port for received packets

Method Detail

### datagramReceived

    public boolean datagramReceived(DatagramPacket datagramPacket)

  Implement DatagramListener method. Set the host and port value to the host and port value from the received packet.

  Specified by:
    `datagramReceived` in interface `DatagramListener`
  Parameters:
    `datagramPacket` - the received packet
  Returns:
    ?

### getHost

    public InetAddress getHost()

  Get the host that the packet will be sent to.

  Returns:
    remote host address

### setHost

    protected void setHost(InetAddress host)

  Set the host that the packet will be sent to.

### getPort

    public int getPort()

  Get the port that the packet will be sent to.

  Returns:
    The remote port number

### setPort

    protected void setPort(int port)

  Set the port that the packet will be sent to.

  Parameters:
    `port` -

### addListener

    public void addListener(DatagramListener datagramListener)

  Adds a DatagramListener to the Channel

  Parameters:
    `datagramListener` -

### removeListener

    public void removeListener(DatagramListener datagramListener)

  Remove a DatagramListener from the Channel

  Parameters:
    `datagramListener` -

### removeListeners

    public void removeListeners()

  Remove every Listeners

### cancel

    public void cancel()

### run

    public void run()

  Thread override method

  Specified by:
    `run` in interface `Runnable`

### relayPacket

    public void relayPacket(DatagramPacket packet)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.