KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > transport > UdpTransportMapping


1 /*_############################################################################
2   _##
3   _## SNMP4J - UdpTransportMapping.java
4   _##
5   _## Copyright 2003-2007 Frank Fock and Jochen Katz (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## You may obtain a copy of the License at
10   _##
11   _## http://www.apache.org/licenses/LICENSE-2.0
12   _##
13   _## Unless required by applicable law or agreed to in writing, software
14   _## distributed under the License is distributed on an "AS IS" BASIS,
15   _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   _## See the License for the specific language governing permissions and
17   _## limitations under the License.
18   _##
19   _##########################################################################*/

20
21
22
23
24
25 package org.snmp4j.transport;
26
27 import org.snmp4j.smi.Address;
28 import java.io.IOException JavaDoc;
29 import org.snmp4j.smi.UdpAddress;
30
31 /**
32  * The <code>UdpTransportMapping</code> is the abstract base class for
33  * UDP transport mappings.
34  * @author Frank Fock
35  * @version 1.0
36  */

37
38 public abstract class UdpTransportMapping extends AbstractTransportMapping {
39
40   protected UdpAddress udpAddress;
41
42
43   public UdpTransportMapping(UdpAddress udpAddress) {
44     this.udpAddress = udpAddress;
45   }
46
47   public Class JavaDoc getSupportedAddressClass() {
48     return UdpAddress.class;
49   }
50
51   /**
52    * Returns the transport address that is used by this transport mapping for
53    * sending and receiving messages.
54    * @return
55    * the <code>Address</code> used by this transport mapping. The returned
56    * instance must not be modified!
57    */

58   public UdpAddress getAddress() {
59     return udpAddress;
60   }
61
62   public Address getListenAddress() {
63     return udpAddress;
64   }
65
66   public abstract void listen() throws IOException JavaDoc;
67
68   public abstract void close() throws IOException JavaDoc;
69
70   public abstract void sendMessage(Address address, byte[] message)
71       throws IOException JavaDoc;
72
73 }
74
Popular Tags