Source Code Cross Referenced for IPQuerier.java in  » Net » GNetWatch » net » fenyo » gnetwatch » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » GNetWatch » net.fenyo.gnetwatch 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GNetWatch
003:         * Copyright 2006, 2007 Alexandre Fenyo
004:         * gnetwatch@fenyo.net
005:         *
006:         * This file is part of GNetWatch.
007:         *
008:         * GNetWatch is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License as published by
010:         * the Free Software Foundation; either version 2 of the License, or
011:         * (at your option) any later version.
012:         *
013:         * GNetWatch is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with GNetWatch; if not, write to the Free Software
020:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
021:         */
022:
023:        package net.fenyo.gnetwatch;
024:
025:        import org.apache.commons.logging.Log;
026:        import org.apache.commons.logging.LogFactory;
027:
028:        import java.net.*;
029:        import java.io.*;
030:
031:        /**
032:         * Instances of this class maintain IP options associated to IP targets.
033:         * @author Alexandre Fenyo
034:         * @version $Id: IPQuerier.java,v 1.9 2007/03/12 05:04:15 fenyo Exp $
035:         */
036:
037:        public class IPQuerier {
038:            private static Log log = LogFactory.getLog(IPQuerier.class);
039:
040:            private final InetAddress address;
041:
042:            private int tos = 0;
043:            private int port_src = 10000;
044:            private int port_dst = 10000;
045:            private int pdu_max_size = 1400;
046:
047:            private boolean use_proxy = false;
048:            private boolean reconnect = false;
049:            private String proxy_host = "";
050:            private int proxy_port = 3128;
051:            private String URL = "";
052:            private int nparallel = 1;
053:
054:            /**
055:             * Constructor.
056:             * @param address target address.
057:             */
058:            public IPQuerier(final InetAddress address) {
059:                this .address = address;
060:                if (Inet4Address.class.isInstance(address))
061:                    this .URL = "http://" + address.toString().substring(1)
062:                            + ":80/";
063:                if (Inet6Address.class.isInstance(address))
064:                    this .URL = "http://[" + address.toString().substring(1)
065:                            + "]:80/";
066:                parametersHaveChanged();
067:            }
068:
069:            /**
070:             * Must be called after some setters have been called.
071:             * @param none.
072:             * @return void.
073:             */
074:            public void update() {
075:                parametersHaveChanged();
076:            }
077:
078:            /**
079:             * Must be called after some setters have been called.
080:             * @param none.
081:             * @return void.
082:             */
083:            // final since it is invoked from the constructor
084:            private final void parametersHaveChanged() {
085:            }
086:
087:            /**
088:             * Returns the TOS attribute.
089:             * @param none.
090:             * @return int TOS attribute.
091:             */
092:            public int getTOS() {
093:                return tos;
094:            }
095:
096:            /**
097:             * Returns the address attribute.
098:             * @param none.
099:             * @return InetAddress address attribute.
100:             */
101:            public InetAddress getAddress() {
102:                return address;
103:            }
104:
105:            /**
106:             * Returns the source port attribute.
107:             * @param none.
108:             * @return int source port attribute.
109:             */
110:            public int getPortSrc() {
111:                return port_src;
112:            }
113:
114:            /**
115:             * Returns the destination port attribute.
116:             * @param none.
117:             * @return int destination port attribute.
118:             */
119:            public int getPortDst() {
120:                return port_dst;
121:            }
122:
123:            /**
124:             * Returns the PDU maximum size attribute.
125:             * @param none.
126:             * @return int PDU maximum size attribute.
127:             */
128:            public int getPDUMaxSize() {
129:                return pdu_max_size;
130:            }
131:
132:            /**
133:             * Checks that we must use the proxy.
134:             * @param none.
135:             * @return boolean true if we must use the proxy.
136:             */
137:            public boolean getUseProxy() {
138:                return use_proxy;
139:            }
140:
141:            /**
142:             * Checks that we must make one connection per GET.
143:             * @param none.
144:             * @return boolean true if we must make one connection per GET.
145:             */
146:            public boolean getReconnect() {
147:                return reconnect;
148:            }
149:
150:            /**
151:             * Returns the proxy host name.
152:             * @param none.
153:             * @return String proxy host name.
154:             */
155:            public String getProxyHost() {
156:                return proxy_host;
157:            }
158:
159:            /**
160:             * Returns the TCP proxy port.
161:             * @param none.
162:             * @return String TCP proxy port.
163:             */
164:            public int getProxyPort() {
165:                return proxy_port;
166:            }
167:
168:            /**
169:             * Returns the URL to connect to.
170:             * @param none.
171:             * @return String URL to connect to.
172:             */
173:            public String getURL() {
174:                return URL;
175:            }
176:
177:            /**
178:             * Returns the number of simultaneous sessions.
179:             * @param none.
180:             * @return int number of simultaneous sessions..
181:             */
182:            public int getNParallel() {
183:                return nparallel;
184:            }
185:
186:            /**
187:             * Set the TOS attribute.
188:             * @param tos TOS attribute.
189:             * @return void.
190:             */
191:            public void setTOS(final int tos) {
192:                this .tos = tos;
193:            }
194:
195:            /**
196:             * Set the source port attribute.
197:             * @param port_src source_port attribute.
198:             * @return void.
199:             */
200:            public void setPortSrc(final int port_src) {
201:                this .port_src = port_src;
202:            }
203:
204:            /**
205:             * Set the destination port attribute.
206:             * @param port_dst destination_port attribute.
207:             * @return void.
208:             */
209:            public void setPortDst(final int port_dst) {
210:                this .port_dst = port_dst;
211:            }
212:
213:            /**
214:             * Set the PDU maximum size attribute.
215:             * @param pdu_max_size PDU maximum size attribute.
216:             * @return void.
217:             */
218:            public void setPDUMaxSize(final int pdu_max_size) {
219:                this .pdu_max_size = pdu_max_size;
220:            }
221:
222:            /**
223:             * Sets it to true if we must use the proxy.
224:             * @param use_proxy true if we must use the proxy.
225:             * @return void.
226:             */
227:            public void setUseProxy(final boolean use_proxy) {
228:                this .use_proxy = use_proxy;
229:            }
230:
231:            /**
232:             * Sets it to true if we must make a new connection for each GET.
233:             * @param reconnect true if we must make a new connection for each GET.
234:             * @return void.
235:             */
236:            public void setReconnect(final boolean reconnect) {
237:                this .reconnect = reconnect;
238:            }
239:
240:            /**
241:             * Sets the proxy host name.
242:             * @param proxy_host proxy host name.
243:             * @return void.
244:             */
245:            public void setProxyHost(final String proxy_host) {
246:                this .proxy_host = proxy_host;
247:            }
248:
249:            /**
250:             * Sets the TCP proxy port.
251:             * @param proxy_port TCP proxy port.
252:             * @return void.
253:             */
254:            public void setProxyPort(final int proxy_port) {
255:                this .proxy_port = proxy_port;
256:            }
257:
258:            /**
259:             * Sets the URL to connect to.
260:             * @param URL URL to connect to.
261:             * @return void.
262:             */
263:            public void setURL(final String URL) {
264:                this .URL = URL;
265:            }
266:
267:            /**
268:             * Sets the number of simultaneous sessions.
269:             * @param nparallel number of simultaneous sessions.
270:             * @return void. 
271:             */
272:            public void setNParallel(final int nparallel) {
273:                this.nparallel = nparallel;
274:            }
275:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.