1 2 23 24 package net.fenyo.gnetwatch; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import java.net.*; 30 import java.io.*; 31 32 37 38 public class IPQuerier { 39 private static Log log = LogFactory.getLog(IPQuerier.class); 40 41 private final InetAddress address; 42 43 private int tos = 0; 44 private int port_src = 10000; 45 private int port_dst = 10000; 46 private int pdu_max_size = 1400; 47 48 private boolean use_proxy = false; 49 private boolean reconnect = false; 50 private String proxy_host = ""; 51 private int proxy_port = 3128; 52 private String URL = ""; 53 private int nparallel = 1; 54 55 59 public IPQuerier(final InetAddress address) { 60 this.address = address; 61 if (Inet4Address.class.isInstance(address)) 62 this.URL = "http://" + address.toString().substring(1) + ":80/"; 63 if (Inet6Address.class.isInstance(address)) 64 this.URL = "http://[" + address.toString().substring(1) + "]:80/"; 65 parametersHaveChanged(); 66 } 67 68 73 public void update() { 74 parametersHaveChanged(); 75 } 76 77 82 private final void parametersHaveChanged() {} 84 85 90 public int getTOS() { 91 return tos; 92 } 93 94 99 public InetAddress getAddress() { 100 return address; 101 } 102 103 108 public int getPortSrc() { 109 return port_src; 110 } 111 112 117 public int getPortDst() { 118 return port_dst; 119 } 120 121 126 public int getPDUMaxSize() { 127 return pdu_max_size; 128 } 129 130 135 public boolean getUseProxy() { 136 return use_proxy; 137 } 138 139 144 public boolean getReconnect() { 145 return reconnect; 146 } 147 148 153 public String getProxyHost() { 154 return proxy_host; 155 } 156 157 162 public int getProxyPort() { 163 return proxy_port; 164 } 165 166 171 public String getURL() { 172 return URL; 173 } 174 175 180 public int getNParallel() { 181 return nparallel; 182 } 183 184 189 public void setTOS(final int tos) { 190 this.tos = tos; 191 } 192 193 198 public void setPortSrc(final int port_src) { 199 this.port_src = port_src; 200 } 201 202 207 public void setPortDst(final int port_dst) { 208 this.port_dst = port_dst; 209 } 210 211 216 public void setPDUMaxSize(final int pdu_max_size) { 217 this.pdu_max_size = pdu_max_size; 218 } 219 220 225 public void setUseProxy(final boolean use_proxy) { 226 this.use_proxy = use_proxy; 227 } 228 229 234 public void setReconnect(final boolean reconnect) { 235 this.reconnect = reconnect; 236 } 237 238 243 public void setProxyHost(final String proxy_host) { 244 this.proxy_host = proxy_host; 245 } 246 247 252 public void setProxyPort(final int proxy_port) { 253 this.proxy_port = proxy_port; 254 } 255 256 261 public void setURL(final String URL) { 262 this.URL = URL; 263 } 264 265 270 public void setNParallel(final int nparallel) { 271 this.nparallel = nparallel; 272 } 273 } 274 | Popular Tags |