1600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/*
2600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Conditions Of Use
3600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
4600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* This software was developed by employees of the National Institute of
5600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Standards and Technology (NIST), an agency of the Federal Government.
6600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Pursuant to title 15 Untied States Code Section 105, works of NIST
7600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* employees are not subject to copyright protection in the United States
8600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* and are considered to be in the public domain.  As a result, a formal
9600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* license is not needed to use the software.
10600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
11600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* This software is provided by NIST as a service and is expressly
12600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* AND DATA ACCURACY.  NIST does not warrant or make any representations
16600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* regarding the use of the software or the results thereof, including but
17600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* not limited to the correctness, accuracy, reliability or usefulness of
18600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* the software.
19600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
20600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Permission to use this software is contingent upon your acceptance
21600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* of the terms of this agreement
22600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
23600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* .
24600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
25600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*/
26600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpackage gov.nist.core.net;
27600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
28600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport java.net.InetAddress;
29600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport java.net.UnknownHostException;
30600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
31600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport javax.sip.address.Hop;
32600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
33600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/**
34600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * An interface that allows you to customize address lookup.
35600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * The user can implement this interface to do DNS lookups or other lookup
36600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * schemes and register it with the stack.
37600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * The default implementation of the address resolver does nothing more than just return back
38600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * the Hop that it was passed (fixing up the port if necessary).
39600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * However, this behavior can be overriden. To override
40600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * implement this interface and register it with the stack using
41600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * {@link gov.nist.javax.sip.SipStackExt#setAddressResolver(AddressResolver)}.
42600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * This interface will be incorporated into version 2.0 of the JAIN-SIP Specification.
43600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
44600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @since 2.0
45600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
46600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
47600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @author M. Ranganathan
48600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
49600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */
50600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpublic interface AddressResolver {
51600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
52600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /**
53600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * Do a name lookup and resolve the given IP address.
54600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * The default implementation is just an identity mapping
55600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * (returns the argument).
56600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     *
57600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @param hop - an incoming Hop containing a potenitally unresolved address.
58600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @return a new hop ( if the address is recomputed ) or the original hop
59600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * if this is just an identity mapping ( the default behavior ).
60600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
61600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    public Hop resolveAddress( Hop hop);
62600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
63600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
64600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
65600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
66600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
67600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang}
68