-
Home
- Project Documentation Project Reports 10
CPD Results
The following document contains the results of PMD's CPD 6.55.0.
Duplications
File | Line |
---|---|
org/bouncycastle/crypto/engines/AESEngine.java | 494 |
org/bouncycastle/crypto/engines/AESEngine.java | 504 |
r0 = T0[C0&255] ^ shift(T0[(C1>>8)&255], 24) ^ shift(T0[(C2>>16)&255],16) ^ shift(T0[(C3>>24)&255],8) ^ KW[r][0]; r1 = T0[C1&255] ^ shift(T0[(C2>>8)&255], 24) ^ shift(T0[(C3>>16)&255], 16) ^ shift(T0[(C0>>24)&255], 8) ^ KW[r][1]; r2 = T0[C2&255] ^ shift(T0[(C3>>8)&255], 24) ^ shift(T0[(C0>>16)&255], 16) ^ shift(T0[(C1>>24)&255], 8) ^ KW[r][2]; r3 = T0[C3&255] ^ shift(T0[(C0>>8)&255], 24) ^ shift(T0[(C1>>16)&255], 16) ^ shift(T0[(C2>>24)&255], 8) ^ KW[r++][3]; C0 = T0[r0&255] ^ shift(T0[(r1>>8)&255], 24) ^ shift(T0[(r2>>16)&255], 16) ^ shift(T0[(r3>>24)&255], 8) ^ KW[r][0]; |
File | Line |
---|---|
org/bouncycastle/crypto/engines/AESEngine.java | 528 |
org/bouncycastle/crypto/engines/AESEngine.java | 538 |
r0 = Tinv0[C0&255] ^ shift(Tinv0[(C3>>8)&255], 24) ^ shift(Tinv0[(C2>>16)&255], 16) ^ shift(Tinv0[(C1>>24)&255], 8) ^ KW[r][0]; r1 = Tinv0[C1&255] ^ shift(Tinv0[(C0>>8)&255], 24) ^ shift(Tinv0[(C3>>16)&255], 16) ^ shift(Tinv0[(C2>>24)&255], 8) ^ KW[r][1]; r2 = Tinv0[C2&255] ^ shift(Tinv0[(C1>>8)&255], 24) ^ shift(Tinv0[(C0>>16)&255], 16) ^ shift(Tinv0[(C3>>24)&255], 8) ^ KW[r][2]; r3 = Tinv0[C3&255] ^ shift(Tinv0[(C2>>8)&255], 24) ^ shift(Tinv0[(C1>>16)&255], 16) ^ shift(Tinv0[(C0>>24)&255], 8) ^ KW[r--][3]; C0 = Tinv0[r0&255] ^ shift(Tinv0[(r3>>8)&255], 24) ^ shift(Tinv0[(r2>>16)&255], 16) ^ shift(Tinv0[(r1>>24)&255], 8) ^ KW[r][0]; |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 273 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 463 |
res = context.removePdu(requestId); } return res; } /** * Encodes a PDU packet. */ public byte[] encodePacket(byte msg_type, int rId, int errstat, int errind, Enumeration ve, Object obj) throws java.io.IOException, EncodingException { byte[] res = null; if (context != null) { res = context.encodePacket(msg_type, rId, errstat, errind, ve, obj); } return res; } public void sendPacket(byte[] packet) { if (context != null) { context.sendPacket(packet); } } /** * Releases the resources held by this context. This method will * decrement the reference counter. When the reference counter reaches * zero the actual context is removed from the pool and destroyed. */ public void destroy() { synchronized(contextPool) { if (context != null) { String hashKey = context.getHashKey(); int count = 0; SnmpContextPoolItem item = (SnmpContextPoolItem) contextPool.get(hashKey); if (item != null) { count = item.getCounter(); count--; item.setCounter(count); } if (count <= 0) { contextPool.remove(hashKey); context.destroy(); } context = null; } } } /** * Destroys all the contexts (v1 and v2c) in the pool and empties the pool. * The underlying implementation uses the same hashtable for both the v1 * and the v2c contexts. * * @see #destroy() * @since 4_14 */ public void destroyPool() { Hashtable copyOfPool = null; synchronized(contextPool) { synchronized(contextPool) { copyOfPool = (Hashtable) contextPool.clone(); } contextPool.clear(); } context = null; |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/MultiResponsePdu.java | 247 |
uk/co/westhawk/snmp/stack/Pdu.java | 870 |
+ " to request " + getReqId()); } return; } // fillin(null) can be called in case of a Decoding exception if (seq != null) { if (seq.isCorrect == true) { int n = -1; try { // Fill in the request id this.req_id = seq.getReqId(); setErrorStatus(seq.getWhatError()); setErrorIndex(seq.getWhereError()); // The varbinds from the response/report are set in a // new Vector. AsnSequence varBind = seq.getVarBind(); int size = varBind.getObjCount(); respVarbinds = new Vector(size, 1); for (n=0; n<size; n++) { Object obj = varBind.getObj(n); if (obj instanceof AsnSequence) { AsnSequence varSeq = (AsnSequence) obj; try { varbind vb = new varbind(varSeq); respVarbinds.addElement(vb); new_value(n, vb); } catch (IllegalArgumentException exc) { } } } // At this point, I don't know whether I received a // response and should fill in only the respVarbind or // whether I received a request (via ListeningContext) // and I should fill in the reqVarbinds. // So when reqVarbinds is empty, I clone the // respVarbinds. if (reqVarbinds.isEmpty()) { reqVarbinds = (Vector) respVarbinds.clone(); } } catch (Exception e) { // it happens that an agent does not encode the varbind // list properly. Since we try do decode as much as // possible there may be wrong elements in this list. DecodingException exc = new DecodingException( "Incorrect varbind list, element " + n); setErrorStatus(AsnObject.SNMP_ERR_DECODINGASN_EXC, exc); } } else { // we couldn't read the whole message // see AsnObject.AsnReadHeader, isCorrect DecodingException exc = new DecodingException( "Incorrect packet. No of bytes received less than packet length."); setErrorStatus(AsnObject.SNMP_ERR_DECODINGPKTLNGTH_EXC, exc); } } // always do 'setChanged', even if there are no varbinds. setChanged(); tell_them(); clearChanged(); |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnInteger.java | 120 |
uk/co/westhawk/snmp/stack/AsnUnsInteger.java | 140 |
public int getValue() { return value; } /** * Returns the string representation of the AsnInteger. * * @return The string of the AsnInteger */ public String toString() { return (String.valueOf(value)); } /** * Returns the number of bytes the integer occupies. */ int size() { int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // 32-bit integer.. change to 56 to write 64-bit long // loop through bytes in value while it is 'empty' for(count=24; count>0; count-=8) { if ( ((value >> count) & 0xFF) != empty) break; } // Check sign bit.. make sure negative's MSB bit is 1, // positives is 0 // (0x00000080 = 0x00 0x80) 0xFFFFFF01 => 0xFF 0x01 // (0x0000007F = 0x7F) 0xFFFFFF80 => 0x80 if (((value >> count) & 0x80) != sign) count += 8; return (count>>3)+1; } /** * Output integer. */ void write(OutputStream out, int pos) throws IOException { int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // Get count for(count=24; count>0; count-=8) { if ( ((value >> count) & 0xFF) != empty) break; } if (((value >> count) & 0x80) != sign) count += 8; // Build header and write value AsnBuildHeader(out, ASN_INTEGER, (count>>3)+1); |
File | Line |
---|---|
uk/co/westhawk/snmp/net/StandardSocket.java | 116 |
uk/co/westhawk/snmp/net/TCPSocket.java | 132 |
soc = new DatagramSocket(isa); } catch (SocketException exc) { String str = "Socket problem: host=" + host + ", port=" + port + ", bindAddr=" + bindAddr + " " + exc.getMessage(); throw (new IOException(str)); } catch (UnknownHostException exc) { String str = "Cannot find host " + host + " " + exc.getMessage(); throw (new IOException(str)); } } public String getReceivedFromHostAddress() { String res = null; if (receiveFromHostAddr != null) { res = receiveFromHostAddr.getHostAddress(); } return res; } public String getSendToHostAddress() { String res = null; if (sendToHostAddr != null) { res = sendToHostAddr.getHostAddress(); } return res; } public String getLocalSocketAddress() { String res = null; if (soc != null) |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 241 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 244 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 236 |
pdu.addOid(svSvcName); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * * The answers are stored in a hashtable, this is done because the speed * can only be calculated with the previous answer. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { varbind var; String hashKey; String oid, index, name; pdu = (GetNextPdu) obs; if (pdu.getErrorStatus() == AsnObject.SNMP_ERR_NOERROR) { var = (varbind) ov; oid = var.getOid().toString(); if (oid.startsWith(svSvcName)) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextv3Basis.java | 1116 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 678 |
buffer.append("_").append(typeSocket); buffer.append("_").append(useAuthentication); buffer.append("_").append(ProtocolNames[authenticationProtocol]); buffer.append("_").append(ProtocolNames[privacyProtocol]); buffer.append("_").append(userAuthenticationPassword); buffer.append("_").append(userName); buffer.append("_").append(usePrivacy); buffer.append("_").append(userPrivacyPassword); buffer.append("_").append(SnmpUtilities.toHexString(contextEngineId)); buffer.append("_").append(contextName); buffer.append("_v").append(getVersion()); return buffer.toString(); } /** * Returns a string representation of the object. * @return The string */ public String toString() |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 424 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 417 |
Enumeration e = modemHash.elements(); while (e.hasMoreElements() && !found) { TreeNode n = (TreeNode) e.nextElement(); found = (n == node); ret++; } } return ret; } /** * Returns the parent <code>TreeNode</code> of the receiver. */ public TreeNode getParent() { return parent; } /** * Returns true if the receiver allows children. */ public boolean getAllowsChildren() { return true; } /** * Returns true if the receiver is a leaf. */ public boolean isLeaf() { return false; } /** * This method starts the action of the bean. It will initialises * all variables before starting. */ public void action() { if (isHostPortReachable()) { lastUpdateDate = new Date(); isGetNextInFlight = false; setRunning(true); } } /** * Implements the running of the bean. * * It will send the Pdu, if the previous one is not still in flight. * @see SNMPRunBean#isRunning() */ public void run() { while (context != null && isRunning()) { if (isGetNextInFlight == false) { // start the GetNext loop again isGetNextInFlight = true; |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/ListeningContextPool.java | 230 |
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 316 |
Item item = (Item) contextPool.get(hashKey); if (item != null) { count = item.getCounter(); count--; item.setCounter(count); } if (count <=0) { contextPool.remove(hashKey); context.destroy(); } context = null; } } } /** * Destroys all the contexts in the pool and empties the pool. * * <p> * Note that by calling this method the whole stack will stop listening * for any packets! The listeners added via the * SnmpContext classes are affected as well. * </p> * * @see #destroy() */ public void destroyPool() { Hashtable copyOfPool = null; synchronized(contextPool) { synchronized(contextPool) { copyOfPool = (Hashtable) contextPool.clone(); } contextPool.clear(); } context = null; Enumeration keys = copyOfPool.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 297 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 298 |
printHash.put(name, index); // perform the GetNext on the just received answer pdu = new GetNextPdu(context); pdu.addObserver(this); pdu.addOid(oid); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } else { // the GetNext loop has ended lastUpdateDate = new Date(); isGetNextInFlight = false; firePropertyChange("resourceNames", null, null); } } else { // the GetNext loop has ended lastUpdateDate = new Date(); isGetNextInFlight = false; firePropertyChange("resourceNames", null, null); } } } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 239 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 241 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 244 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 236 |
pdu.addOid(svPrintQName); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * * The answers are stored in a hashtable, this is done because the speed * can only be calculated with the previous answer. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { varbind var; String hashKey; String oid, index, name; pdu = (GetNextPdu) obs; if (pdu.getErrorStatus() == AsnObject.SNMP_ERR_NOERROR) { var = (varbind) ov; oid = ""; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 253 |
pdu.addOid(svPrintQNumJobs + "." + ind); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * The update method according to the Observer interface, it will be * called when the Pdu response is received. * The property change event is fired. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { pdu = (GetPdu_vec) obs; varbind [] varbinds = (varbind []) ov; if (pdu.getErrorStatus() == AsnObject.SNMP_ERR_NOERROR) { |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnUnsInteger.java | 209 |
uk/co/westhawk/snmp/stack/AsnUnsInteger64.java | 192 |
System.out.println("\tAsnUnsInteger(): value = " + value + ", pos = " + pos); } for(; count>=0; count-=8) { out.write((byte)((value >> count) & 0xFF)); } } /** * Changes an array of bytes into a long. * Thanks to Julien Conan (jconan@protego.net) for improving * this method. * * @param data the array of bytes * @return the int representation of the array */ protected long bytesToLong(byte[] data) throws IOException { DataInputStream dis = new DataInputStream( new ByteArrayInputStream(data)); long val = 0; int size = data.length; for (int n=0; n<size; n++) { val = (val << 8) + dis.readUnsignedByte(); } return val; } /** * Compares this object to the specified object. The result is * <code>true</code> if and only if the argument is not * <code>null</code> and is an <code>AsnUnsInteger</code> object that * contains the same <code>long</code> value as this object. * * @param obj the object to compare with. * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. */ public boolean equals(Object obj) { if (obj instanceof AsnUnsInteger) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContext.java | 216 |
uk/co/westhawk/snmp/stack/SnmpContextv2c.java | 169 |
if (pduSeq != null) { // got a message Integer rid = new Integer(pduSeq.getReqId()); Pdu answ = getPdu(rid); if (answ != null) { answ.fillin(pduSeq); } else { if (AsnObject.debug > 3) { System.out.println(getClass().getName() + ".processIncomingResponse(): No Pdu with reqid " + rid.intValue()); } } } else { if (AsnObject.debug > 3) { System.out.println(getClass().getName() + ".processIncomingResponse(): Error - missing seq input"); } } } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 191 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 257 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 203 |
} /** * Returns the date of the moment when this bean was last updated. * This might be null when the first time the update was not finished. * * @return the last update date */ public Date getLastUpdateDate() { return lastUpdateDate; } /** * This method starts sending the SNMP request. All properties should be * set before this method is called. * * The actual sending will take place in the run method. * It makes a new snmp context and initialises all variables before * starting. */ public void action() { if (isHostPortReachable()) { lastUpdateDate = new Date(); isPduInFlight = false; setRunning(true); } } /** * The run method according to the Runnable interface. * This method will send the Pdu request, if the previous one is not * still in flight. * @see SNMPRunBean#isRunning() */ public void run() { while (context != null && isRunning()) { String ind = getIndex(); if (isPduInFlight == false && ind != null && ind.length() > 0) { isPduInFlight = true; pdu = new GetPdu_vec(context, NR_OID); pdu.addObserver(this); pdu.addOid(svPrintQName + "." + ind); |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContext.java | 362 |
uk/co/westhawk/snmp/stack/SnmpContextv2c.java | 291 |
StringBuffer buffer = new StringBuffer("SnmpContext["); buffer.append("host=").append(hostname); buffer.append(", port=").append(hostPort); buffer.append(", bindAddress=").append(bindAddr); buffer.append(", socketType=").append(typeSocket); buffer.append(", community=").append(community); buffer.append(", #trapListeners=").append(trapSupport.getListenerCount()); buffer.append(", #pduListeners=").append(pduSupport.getListenerCount()); buffer.append("]"); return buffer.toString(); } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 357 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 543 |
Enumeration keys = copyOfPool.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); SnmpContextPoolItem item = (SnmpContextPoolItem) copyOfPool.get(key); if (item != null) { SnmpContextBasisFace cntxt = (SnmpContextBasisFace) item.getContext(); cntxt.destroy(); } } copyOfPool.clear(); } public boolean isDestroyed() { boolean isDestroyed = true; if (context != null) { isDestroyed = context.isDestroyed(); } return isDestroyed; } /** * Returns a context from the pool. * The pre-existing context (if there is any) is destroyed. * This methods checks for an existing context that matches all our * properties. If such a context does not exist, a new one is created and * added to the pool. * * @return A context from the pool * @see #getHashKey */ protected SnmpContext getMatchingContext() throws java.io.IOException |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 758 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 982 |
int newL = plaintext.length; int bcount = newL / 16; byte[] result = new byte[newL]; byte [] in = new byte[16]; byte [] out = new byte[16]; int posIn = 0; int posResult = 0; // initial input is the iv System.arraycopy(iv, 0, in, 0, 16); for (int b=0; b<bcount; b++) { aes.processBlock(in, 0, out, 0); for (int i=0;i < 16;i++) { |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 740 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 684 |
return ""+portIndex + " " + portName + " " + sig_state[sigStatus]; } /** * Returns the children of the reciever as an Enumeration. */ public Enumeration children() { return null; } /** * Returns the number of children <code>TreeNode</code>s the receiver * contains. */ public int getChildCount() { return 0; } /** * Returns the child <code>TreeNode</code> at index * <code>childIndex</code>. */ public TreeNode getChildAt(int childIndex) { return null; } /** * Returns the index of <code>node</code> in the receivers children. * If the receiver does not contain <code>node</code>, -1 will be * returned. */ public int getIndex(TreeNode node) { return -1; } /** * Returns the parent <code>TreeNode</code> of the receiver. */ public TreeNode getParent() { return parent; } /** * Returns true if the receiver allows children. */ public boolean getAllowsChildren() { return true; } /** * Returns true if the receiver is a leaf. */ public boolean isLeaf() { return true; } } // end class PortInfo class TreeUpdate implements Runnable { public void run() { fireTreeModelChanged(); firePropertyChange("modems", null, null); } } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/ListeningContextPool.java | 230 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 504 |
Item item = (Item) contextPool.get(hashKey); if (item != null) { count = item.getCounter(); count--; item.setCounter(count); } if (count <=0) { contextPool.remove(hashKey); context.destroy(); } context = null; } } } /** * Destroys all the contexts in the pool and empties the pool. * * <p> * Note that by calling this method the whole stack will stop listening * for any packets! The listeners added via the * SnmpContext classes are affected as well. * </p> * * @see #destroy() */ public void destroyPool() { Hashtable copyOfPool = null; synchronized(contextPool) { synchronized(contextPool) { copyOfPool = (Hashtable) contextPool.clone(); } contextPool.clear(); } context = null; |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 194 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 188 |
} public String getHost() { return hostname; } public int getPort() { return hostPort; } public String getBindAddress() { return bindAddr; } public String getTypeSocket() { return socketType; } public String getSendToHostAddress() { String res = null; if (context != null) { res = context.getSendToHostAddress(); } return res; } public String getReceivedFromHostAddress() { String res = null; if (context != null) { res = context.getReceivedFromHostAddress(); } return res; } public String getCommunity() |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 298 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 325 |
MD5Digest mdc = new MD5Digest(); mdc.reset(); byte [] beid = toBytes(engineId); if ((beid != null) && (passwKey != null)) { // see page 169 of 0-13-021453-1 A Practical Guide to SNMP mdc.update(passwKey, 0, passwKey.length); mdc.update(beid, 0, beid.length); mdc.update(passwKey, 0, passwKey.length); ret = new byte[mdc.getDigestSize()]; mdc.doFinal(ret, 0); } return ret; } /** * Converts the user's password and the SNMP Engine Id to the localized key * using the SHA protocol. * * @param passwKey The printable user password * @param engineId The SNMP engine Id * @see SnmpContextv3#setUserAuthenticationPassword(String) */ public static byte [] getLocalizedKeySHA1(byte[] passwKey, String engineId) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnInteger.java | 150 |
uk/co/westhawk/snmp/stack/AsnUnsInteger.java | 170 |
uk/co/westhawk/snmp/stack/AsnUnsInteger64.java | 153 |
for(count=24; count>0; count-=8) { if ( ((value >> count) & 0xFF) != empty) break; } // Check sign bit.. make sure negative's MSB bit is 1, // positives is 0 // (0x00000080 = 0x00 0x80) 0xFFFFFF01 => 0xFF 0x01 // (0x0000007F = 0x7F) 0xFFFFFF80 => 0x80 if (((value >> count) & 0x80) != sign) count += 8; return (count>>3)+1; } /** * Output integer. */ void write(OutputStream out, int pos) throws IOException { int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // Get count for(count=24; count>0; count-=8) |
File | Line |
---|---|
uk/co/westhawk/snmp/net/StandardSocket.java | 91 |
uk/co/westhawk/snmp/net/TCPSocket.java | 108 |
soc = new DatagramSocket(sendToHostPort, locBindAddr); } catch (SocketException exc) { String str = "Socket problem: port=" + port + ", bindAddr=" + bindAddr + " " + exc.getMessage(); throw (new IOException(str)); } } public void create(String host, int port, String bindAddr) throws IOException { sendToHostPort = port; receiveFromHostPort = sendToHostPort; // initialise (once!) try { sendToHostAddr = InetAddress.getByName(host); receiveFromHostAddr = sendToHostAddr; // initialise (once!) locBindAddr = null; if (bindAddr != null) { locBindAddr = InetAddress.getByName(bindAddr); } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 297 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 295 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 298 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 290 |
printHash.put(name, index); // perform the GetNext on the just received answer pdu = new GetNextPdu(context); pdu.addObserver(this); pdu.addOid(oid); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } else { // the GetNext loop has ended lastUpdateDate = new Date(); isGetNextInFlight = false; firePropertyChange("resourceNames", null, null); |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 356 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 424 |
sha = new SHA1Digest(); byte [] passwordBuf = new byte[64]; int pl = password.length(); byte [] pass = new byte[pl]; // copy to byte array - stripping off top byte for (int i=0;i<pl; i++) { pass[i] = (byte) (0xFF & password.charAt(i)); } int count=0; int passwordIndex = 0; Date then = (AsnObject.debug > 1) ? new Date() : null ; synchronized (sha) |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 309 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 253 |
pdu.addOid(svPrintQNumJobs + "." + ind); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * The update method according to the Observer interface, it will be * called when the Pdu response is received. * The property change event is fired. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 313 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 309 |
pdu.addOid(ssnActiveCurrentService); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * * The answers are stored in a hashtable, this is done because the speed * can only be calculated with the previous answer. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { int service; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 313 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 487 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 215 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 239 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 241 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 244 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 236 |
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 309 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 253 |
pdu.addOid(ssnActiveCurrentService); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * * The answers are stored in a hashtable, this is done because the speed * can only be calculated with the previous answer. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 1088 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 1102 |
ret[j++] = (byte)((v >>> 24) & 0xFF); ret[j++] = (byte)((v >>> 16) & 0xFF); ret[j++] = (byte)((v >>> 8) & 0xFF); ret[j++] = (byte)((v >>> 0) & 0xFF); } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 495 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 490 |
pduGetNext.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * */ public void update(Observable obs, Object ov) { boolean loopHasEnded = false; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 316 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 490 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 218 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 242 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 244 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 247 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 239 |
uk/co/westhawk/snmp/beans/OneInterfaceBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 243 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 312 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 256 |
pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * * The answers are stored in a hashtable, this is done because the speed * can only be calculated with the previous answer. * * @see SNMPBean#addPropertyChangeListener */ public void update(Observable obs, Object ov) { |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NcdPerfDataBean.java | 720 |
uk/co/westhawk/snmp/beans/NcdPerfDataBean.java | 791 |
int i = ((AsnInteger) vars[0].getValue()).getValue(); String n = ((AsnOctets) vars[1].getValue()).getValue(); String v = ""; if (vars[2].getValue() instanceof AsnOctets) { v = ((AsnOctets) vars[2].getValue()).getValue(); } |
File | Line |
---|---|
uk/co/westhawk/snmp/pdu/OneGetNextPdu.java | 115 |
uk/co/westhawk/snmp/pdu/OneGetPdu.java | 113 |
uk/co/westhawk/snmp/pdu/OneInformPdu.java | 123 |
public OneGetNextPdu(SnmpContextBasisFace con, String oid, Observer o) throws PduException, java.io.IOException { super(con); if (o != null) { addObserver(o); } addOid(oid); send(); } /** * The value of the request is set. This will be called by * Pdu.fillin(). * * @param n the index of the value * @param a_var the value * @see Pdu#new_value */ protected void new_value(int n, varbind a_var) { if (n == 0) { var = a_var; } } /** * This method notifies all observers. * This will be called by Pdu.fillin(). * * <p> * Unless an exception occurred the Object to the update() method of the * Observer will be a varbind, so any AsnObject type can be returned. * In the case of an exception, that exception will be passed. * </p> */ protected void tell_them() { notifyObservers(var); } } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 495 |
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 316 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 218 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 242 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 244 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 247 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 239 |
uk/co/westhawk/snmp/beans/OneInterfaceBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 243 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 312 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 256 |
pduGetNext.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } /** * This method is called when the Pdu response is received. When all * answers are received it will fire the property change event. * */ public void update(Observable obs, Object ov) { |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 428 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 640 |
System.out.println(title + " " + contextPool.size() + " context(s)"); Enumeration keys = contextPool.keys(); int i=0; while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); SnmpContextPoolItem item = (SnmpContextPoolItem) contextPool.get(key); if (item != null) { int count = item.getCounter(); |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 371 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 438 |
synchronized (sha) { while (count < ONEMEG) { int cp = 0; int i=0; while (i<64) { int pim = passwordIndex % pl; int len = 64 - cp ; int pr = pl - pim; if (len > pr) { len = pr; } System.arraycopy(pass, pim, passwordBuf, cp, len); i+= len; cp+=len; passwordIndex += len; } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 276 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 450 |
} /** * This method starts the action of the bean. It will initialises * all variables before starting. */ public void action() { if (isHostPortReachable()) { lastUpdateDate = new Date(); isGetNextInFlight = false; setRunning(true); } } /** * Implements the running of the bean. * * It will send the Pdu, if the previous one is not still in flight. * @see SNMPRunBean#isRunning() */ public void run() { while (context != null && isRunning()) { if (isGetNextInFlight == false) { // start the GetNext loop again isGetNextInFlight = true; pdu = new GetNextPdu_vec(context, NR_OID); pdu.addObserver(this); pdu.addOid(ssnActiveCallReferenceNum); |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 176 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 145 |
public OneNTServiceBean(String h, int p, String b) { this(); setHost(h); setPort(p); setBindAddress(b); } /** * Sets the index of the NT network service that will be requested. * @param ind the index * @see #getIndex() * @see NTServiceNamesBean#getIndex(String) */ public void setIndex(String ind) { if (ind != null && ind.length() > 0) { index = ind; } } /** * Returns the index of the NT network service. * @return the index * @see #setIndex(String) */ public String getIndex() { return index; } /** * Returns the name of the NT network service. * @return the name */ public String getName() { return name; } /** * Returns the installation status of the NT network service. * @return the installation status * @see #msg_inst_state */ public String getInstalledState() |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 142 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 176 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 145 |
public OneNTPrintQBean(String h, int p, String b) { this(); setHost(h); setPort(p); setBindAddress(b); } /** * Sets the index of the NT print queue that will be requested. * @param ind the index * @see #getIndex() * @see NTPrintQBean#getIndex(String) */ public void setIndex(String ind) { if (ind != null && ind.length() > 0) { index = ind; } } /** * Returns the index of the NT print queue. * @return the index * @see #setIndex(String) */ public String getIndex() { return index; } /** * Returns the name of the NT print queue. * @return the name */ public String getName() { return name; } /** * Returns the number of jobs currently in this NT print queue. * @return the number of jobs */ public int getNumJobs() |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnInteger.java | 139 |
uk/co/westhawk/snmp/stack/AsnInteger.java | 167 |
uk/co/westhawk/snmp/stack/AsnUnsInteger.java | 159 |
uk/co/westhawk/snmp/stack/AsnUnsInteger.java | 188 |
{ int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // 32-bit integer.. change to 56 to write 64-bit long // loop through bytes in value while it is 'empty' for(count=24; count>0; count-=8) { if ( ((value >> count) & 0xFF) != empty) break; } // Check sign bit.. make sure negative's MSB bit is 1, // positives is 0 // (0x00000080 = 0x00 0x80) 0xFFFFFF01 => 0xFF 0x01 // (0x0000007F = 0x7F) 0xFFFFFF80 => 0x80 if (((value >> count) & 0x80) != sign) count += 8; |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnUnsInteger64.java | 142 |
uk/co/westhawk/snmp/stack/AsnUnsInteger64.java | 172 |
{ int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // 64-bit integer.. change to 24 to write 32-bit long // loop through bytes in value while it is 'empty' for(count=56; count>0; count-=8) { if ( ((value >> count) & 0xFF) != empty) break; } // Check sign bit.. make sure negative's MSB bit is 1, // positives is 0 // (0x00000080 = 0x00 0x80) 0xFFFFFF01 => 0xFF 0x01 // (0x0000007F = 0x7F) 0xFFFFFF80 => 0x80 if (((value >> count) & 0x80) != sign) count += 8; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 658 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 607 |
if (loopHasEnded) { lastUpdateDate = new Date(); javax.swing.SwingUtilities.invokeLater(new TreeUpdate()); isGetNextInFlight = false; } } /** * Sets the parent for this TreeNode. If the parent is not set, this * class should be the root of the TreeModel. */ public void setParent (TreeNode p) { parent = p; } /** * Sets the DefaultTreeModel for this TreeNode. The tree model is used * for notifying when any of the nodes were added, removed or changed. */ public void setDefaultTreeModel (DefaultTreeModel model) { treeModel = model; } /** * Fire the property event. * * @see * DefaultTreeModel#nodeStructureChanged */ protected void fireTreeModelChanged() { if (treeModel != null) { treeModel.nodeStructureChanged(this); } } class PortInfo extends Object implements TreeNode |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NcdPerfDataBean.java | 192 |
uk/co/westhawk/snmp/beans/SNMPRunBean.java | 113 |
} /** * Returns the update interval. This is the interval that the * bean will sleep between 2 requests. * * @return the update interval in msec * @see #setUpdateInterval(int) * @see #setUpdateInterval(String) */ public int getUpdateInterval() { return interval; } /** * Sets the update interval. This is the interval that the * bean will sleep between 2 requests. * The default will be <em>3000</em> (= 3 sec). * * @param i the interval in msec * @see #getUpdateInterval * @see #setUpdateInterval(String) */ public void setUpdateInterval(int i) { if (interval != i) { interval = i; } } /** * Sets the update interval as String. * * @param i the interval in msec as String * @see #getUpdateInterval * @see #setUpdateInterval(int) */ public void setUpdateInterval(String i) { int iNo; try { iNo = Integer.valueOf(i.trim()).intValue(); setUpdateInterval(iNo); } catch (NumberFormatException exp) { } } /** * Returns the date of the moment when this bean was last updated. * This might be null when the first time the update was not finished. * * @return the last update date */ public Date getLastUpdateDate() |
File | Line |
---|---|
uk/co/westhawk/snmp/pdu/BlockPdu.java | 111 |
uk/co/westhawk/snmp/stack/Pdu.java | 333 |
public void addOid(String oid) { varbind vb = new varbind(oid); addOid(vb); } /** * Adds an OID to the PDU and the value that has to be set. * This is only useful for the SET type. * * @param oid The oid * @see SetPdu#addOid(String, AsnObject) * @see #SET */ public void addOid(String oid, AsnObject val) { varbind vb = new varbind(oid, val); addOid(vb); } /** * Adds an OID (object identifier) to the PDU and the value that has * to be set. * This is only useful for the SET type. * * @param oid The oid * @param val The value * @see Pdu#addOid(AsnObjectId, AsnObject) * @see varbind * @since 4_12 */ public void addOid(AsnObjectId oid, AsnObject val) { varbind vb = new varbind(oid, val); addOid(vb); } /** * Adds an OID (object identifier) to the PDU. The OID indicates which * MIB variable we request or which MIB variable should be set. * * @param oid The oid * @see Pdu#addOid(AsnObjectId) * @see varbind * @since 4_12 */ public void addOid(AsnObjectId oid) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnEncoderBase.java | 98 |
uk/co/westhawk/snmp/stack/AsnEncoderv1.java | 135 |
asnPduObject.add(new AsnInteger(errind)); // errindex // Create VarbindList sequence AsnObject asnVBLObject = asnPduObject.add(new AsnSequence()); // Add variable bindings while (ve.hasMoreElements()) { asnVBObject = asnVBLObject.add(new AsnSequence()); varbind vb = (varbind) ve.nextElement(); asnVBObject.add(vb.getOid()); asnVBObject.add(vb.getValue()); } return asnPduObject; } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 271 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 302 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 300 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 303 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 295 |
pdu.addOids(prev); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } else { // the GetNext loop has ended lastUpdateDate = new Date(); isGetNextInFlight = false; firePropertyChange("InterfaceIndexes", null, null); |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 495 |
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 316 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 490 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 218 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 242 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 244 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 247 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 239 |
uk/co/westhawk/snmp/beans/NcdPerfDataBean.java | 396 |
uk/co/westhawk/snmp/beans/OneInterfaceBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 243 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 312 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 256 |
pduGetNext.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } try { Thread.sleep(interval); } catch (InterruptedException ix) { ; } } } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 216 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 218 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 220 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 213 |
printHash.clear(); lastUpdateDate = new Date(); isGetNextInFlight = false; setRunning(true); } } /** * Implements the running of the bean. * * It will send the Pdu, if the previous one is not still in flight. * @see SNMPRunBean#isRunning() */ public void run() { while (context != null && isRunning()) { if (isGetNextInFlight == false) { // start the GetNext loop again isGetNextInFlight = true; pdu = new GetNextPdu(context); pdu.addObserver(this); pdu.addOid(svPrintQName); |
File | Line |
---|---|
uk/co/westhawk/snmp/event/RawPduReceivedSupport.java | 77 |
uk/co/westhawk/snmp/event/RequestPduReceivedSupport.java | 77 |
public RawPduReceivedSupport(Object src) { source = src; } /** * Removes all the listeners. */ public synchronized void empty() { if (pduListeners != null) { pduListeners.removeAllElements(); } } /** * Returns the number of listeners. * * @return The number of listeners. */ public synchronized int getListenerCount() { int c=0; if (pduListeners != null) { c = pduListeners.size(); } return c; } /** * Adds the specified pdu listener to receive pdus. */ public synchronized void addRawPduListener(RawPduListener listener) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnEncoderv1.java | 165 |
uk/co/westhawk/snmp/stack/AsnEncoderv2c.java | 95 |
asnTopSeq.add(new AsnInteger(AsnObject.SNMP_VERSION_1)); asnTopSeq.add(new AsnOctets(context.getCommunity())); // community // Create PDU sequence. AsnObject asnPduObject = EncodePdu(msg_type, pduId, errstat, errind, ve); asnTopSeq.add(asnPduObject); if (AsnObject.debug > 10) { System.out.println("\n" + getClass().getName() + ".EncodeSNMP(): "); |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/ReportPdu.java | 125 |
uk/co/westhawk/snmp/stack/ResponsePdu.java | 136 |
public void getErrorIndex(int errorIndex) { errind = errorIndex; } /** * The Report PDU does not get a response back. So it should be sent once. */ void transmit() { transmit(false); } /** * Returns the string representation of this object. * * @return The string of the PDU */ public String toString() { return super.toString(true); } /** * Has no meaning, since there is not response. */ protected void new_value(int n, varbind res){} /** * Has no meaning, since there is not response. */ protected void tell_them(){} /** * Returns that this type of PDU is <em>not</em> expecting a response. * This method is used in AbstractSnmpContext to help determine whether * or not to start a thread that listens for a response when sending this * PDU. * The default is <em>false</em>. * * @return true if a response is expected, false if not. */ protected boolean isExpectingResponse() { return false; } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 438 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 650 |
SnmpContext cntxt = (SnmpContext) item.getContext(); if (cntxt == context) { System.out.println("\tcurrent context: "); } System.out.println("\tcontext " + i + ": " + key + ", count: " + count + ", " + cntxt.toString() + "\n" + ", " + cntxt.getDebugString()); i++; } } |
File | Line |
---|---|
uk/co/westhawk/snmp/pdu/GetNextPdu_vec.java | 111 |
uk/co/westhawk/snmp/pdu/GetPdu_vec.java | 110 |
uk/co/westhawk/snmp/pdu/InformPdu_vec.java | 103 |
uk/co/westhawk/snmp/pdu/SetPdu_vec.java | 97 |
public GetNextPdu_vec(SnmpContextBasisFace con, int count) { super(con); value = new varbind[count]; } /** * The value of the request is set. This will be called by * Pdu.fillin(). * * @param n the index of the value * @param var the value * @see Pdu#new_value */ protected void new_value(int n, varbind var) { if (n <value.length) { value[n] = var; } } /** * This method notifies all observers. * This will be called by Pdu.fillin(). * * <p> * If no exception occurred whilst receiving the response, the Object to the * update() method of the Observer will be an array of * varbinds, so they may contains any AsnObject type. * If an exception occurred, that exception will be passed as the Object * to the update() method. * </p> */ protected void tell_them() { notifyObservers(value); } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnUnsInteger.java | 133 |
uk/co/westhawk/snmp/stack/AsnUnsInteger64.java | 116 |
} /** * Returns the value representation of the AsnUnsInteger. * * @return The value of the AsnUnsInteger */ public long getValue() { return value; } /** * Returns the string representation of the AsnUnsInteger. * * @return The string of the AsnUnsInteger */ public String toString() { return (String.valueOf(value)); } /** * Returns the number of bytes the integer occupies. */ int size() { int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // 32-bit integer.. change to 56 to write 64-bit long // loop through bytes in value while it is 'empty' for(count=24; count>0; count-=8) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContext.java | 269 |
uk/co/westhawk/snmp/stack/SnmpContextv2c.java | 203 |
if (pduSeq != null) { byte type = pduSeq.getRespType(); switch (type) { case SnmpConstants.GET_REQ_MSG: pdu = new GetPdu(this); break; case SnmpConstants.GETNEXT_REQ_MSG: pdu = new GetNextPdu(this); break; case SnmpConstants.SET_REQ_MSG: pdu = new SetPdu(this); break; |
File | Line |
---|---|
org/bouncycastle/crypto/digests/MD5Digest.java | 107 |
org/bouncycastle/crypto/digests/SHA1Digest.java | 111 |
out[outOff + 3] = (byte)(word >>> 24); } public int doFinal( byte[] out, int outOff) { finish(); unpackWord(H1, out, outOff); unpackWord(H2, out, outOff + 4); unpackWord(H3, out, outOff + 8); unpackWord(H4, out, outOff + 12); |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 457 |
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 276 |
} /** * This method starts the action of the bean. It will initialises * all variables before starting. */ public void action() { if (isHostPortReachable()) { lastUpdateDate = new Date(); isGetNextInFlight = false; setRunning(true); } } /** * Implements the running of the bean. * * It will send the Pdu, if the previous one is not still in flight. * @see SNMPRunBean#isRunning() */ public void run() { while (context != null && isRunning()) { if (isGetNextInFlight == false) { // start the GetNext loop again isGetNextInFlight = true; |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnInteger.java | 120 |
uk/co/westhawk/snmp/stack/AsnUnsInteger64.java | 123 |
public int getValue() { return value; } /** * Returns the string representation of the AsnInteger. * * @return The string of the AsnInteger */ public String toString() { return (String.valueOf(value)); } /** * Returns the number of bytes the integer occupies. */ int size() { int count, empty = 0x00, sign = 0x00; if (value < 0) { empty = 0xFF; sign = 0x80; } // 32-bit integer.. change to 56 to write 64-bit long // loop through bytes in value while it is 'empty' for(count=24; count>0; count-=8) |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContext.java | 281 |
uk/co/westhawk/snmp/stack/SnmpContextv2c.java | 230 |
pdu = new SetPdu(this); break; //case SnmpConstants.GET_RSP_MSG: // A longly response should never be received here. // They should come in via the processIncomingResponse // route. //case SnmpConstants.GETBULK_REQ_MSG: // not in v1 //case SnmpConstants.INFORM_REQ_MSG: // not in v1 //case SnmpConstants.GET_RPRT_MSG: // not in v1 //case SnmpConstants.TRPV2_REQ_MSG: // not in v1 default: if (AsnObject.debug > 3) { System.out.println(getClass().getName() + ".ProcessIncomingPdu(): PDU received with type " + pduSeq.getRespTypeString() + ". Ignoring it."); } } if (pdu != null) { pdu.fillin(pduSeq); } } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/OneInterfaceBean.java | 189 |
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 191 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 257 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 203 |
} /** * Returns the date of the moment when this bean was last updated. * This might be null when the first time the update was not finished. * * @return the last update date */ public Date getLastUpdateDate() { return lastUpdateDate; } /** * This method starts sending the SNMP request. All properties should be * set before this method is called. * * The actual sending will take place in the run method. * It makes a new snmp context and initialises all variables before * starting. */ public void action() { if (isHostPortReachable()) { lastUpdateDate = new Date(); isPduInFlight = false; setRunning(true); } } /** * The run method according to the Runnable interface. * This method will send the Pdu request, if the previous one is not * still in flight. * @see SNMPRunBean#isRunning() */ public void run() { while (context != null && isRunning()) { |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 398 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 463 |
sha.doFinal(ret, 0); } if (AsnObject.debug > 1) { Date now = new Date(); long diff = now.getTime() - then.getTime(); System.out.println("(Complex) pass to key takes " + diff/1000.0); } return ret; } /** * Converts the user's password to an authentication key using the MD5 * protocol. Note, this is not the same as generating the localized key * as is * described in <a href="http://www.ietf.org/rfc/rfc3414.txt">SNMP-USER-BASED-SM-MIB</a>. * * @param password The printable user password * @see SnmpContextv3#setUserAuthenticationPassword(String) * @see #getLocalizedKeyMD5 */ public static byte [] passwordToKeyMD5(String password) |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 576 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 271 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 302 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 300 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 303 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 295 |
pdu.addOid(var[4].getOid().toString()); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } else { |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/ReportPdu.java | 128 |
uk/co/westhawk/snmp/stack/ResponsePdu.java | 139 |
uk/co/westhawk/snmp/stack/TrapPduv2.java | 106 |
} /** * The Report PDU does not get a response back. So it should be sent once. */ void transmit() { transmit(false); } /** * Returns the string representation of this object. * * @return The string of the PDU */ public String toString() { return super.toString(true); } /** * Has no meaning, since there is not response. */ protected void new_value(int n, varbind res){} /** * Has no meaning, since there is not response. */ protected void tell_them(){} /** * Returns that this type of PDU is <em>not</em> expecting a response. * This method is used in AbstractSnmpContext to help determine whether * or not to start a thread that listens for a response when sending this * PDU. * The default is <em>false</em>. * * @return true if a response is expected, false if not. */ protected boolean isExpectingResponse() { return false; } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContext.java | 170 |
uk/co/westhawk/snmp/stack/SnmpContextv2c.java | 147 |
ByteArrayOutputStream bay = enc.EncodeSNMP(this, msg_type, rId, errstat, errind, ve); int sz = bay.size(); if (sz > maxRecvSize) { throw new EncodingException("Packet size ("+ sz + ") is > maximum size (" + maxRecvSize +")"); } packet = bay.toByteArray(); } return packet; } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextPool.java | 261 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 439 |
if (context == null) { context = getMatchingContext(); } return context.addPdu(pdu); } public boolean removePdu(int requestId) { boolean res = false; if (context != null) { res = context.removePdu(requestId); } return res; } /** * Encodes a PDU packet. */ public byte[] encodePacket(byte msg_type, int rId, int errstat, |
File | Line |
---|---|
org/bouncycastle/crypto/engines/DESEngine.java | 459 |
org/bouncycastle/crypto/engines/DESEngine.java | 471 |
work ^= wKey[round * 4 + 0]; fval = SP7[ work & 0x3f]; fval |= SP5[(work >>> 8) & 0x3f]; fval |= SP3[(work >>> 16) & 0x3f]; fval |= SP1[(work >>> 24) & 0x3f]; work = right ^ wKey[round * 4 + 1]; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/UsmBeingDiscoveredBean.java | 231 |
uk/co/westhawk/snmp/beans/UsmBeingDiscoveredBean.java | 276 |
+ "IOException: " + iexc.getMessage()); } } catch (PduException pexc) { if (AsnObject.debug > 4) { System.out.println(getClass().getName() + ".sendEngineIdReport(): " + "PduException: " + pexc.getMessage()); } } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnObjectId.java | 640 |
uk/co/westhawk/snmp/stack/AsnOctets.java | 939 |
long v2[] = anotherOid.value; int i = 0; int j = 0; while (n-- != 0) { if (v1[i++] != v2[j++]) { return false; } } return true; } } return false; } /** * Returns a hash code for this OID. * The hash value of the empty OID is zero. * * @return a hash code value for this object. */ public int hashCode() { int h = 0; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 492 |
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 595 |
pduGetNext.addOid(charPortOperStatus); try { pduGetNext.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AscendActiveSessionBean.java | 313 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 487 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 576 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 215 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 271 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 239 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 302 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 241 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 300 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 244 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 303 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 236 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 295 |
uk/co/westhawk/snmp/beans/OneNTPrintQBean.java | 240 |
uk/co/westhawk/snmp/beans/OneNTServiceBean.java | 309 |
uk/co/westhawk/snmp/beans/OneNTSharedResBean.java | 253 |
pdu.addOid(ssnActiveCurrentService); try { pdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AsnEncoderv1.java | 101 |
uk/co/westhawk/snmp/stack/AsnEncoderv1.java | 169 |
IpAddress, generic_trap, specific_trap, timeTicks, ve); asnTopSeq.add(asnPduObject); if (AsnObject.debug > 10) { System.out.println("\n" + getClass().getName() + ".EncodeSNMP(): "); } // Write SNMP object bout = new ByteArrayOutputStream(); asnTopSeq.write(bout); return bout; } |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContext.java | 156 |
uk/co/westhawk/snmp/stack/SnmpContextv2c.java | 132 |
} public byte[] encodePacket(byte msg_type, int rId, int errstat, int errind, Enumeration ve, Object obj) throws IOException, EncodingException { byte [] packet = null; if (isDestroyed == true) { throw new EncodingException("Context can no longer be used, since it is already destroyed"); } else { |
File | Line |
---|---|
uk/co/westhawk/snmp/util/SnmpUtilities.java | 773 |
uk/co/westhawk/snmp/util/SnmpUtilities.java | 998 |
posResult++; posIn++; } } // and the leftovers. if (posIn < newL) { aes.processBlock(in, 0, out, 0); for (int i =0;posIn < newL; i++) { result[posResult] = (byte) (out[i] ^ plaintext[posIn]); |
File | Line |
---|---|
org/bouncycastle/crypto/engines/DESEngine.java | 464 |
org/bouncycastle/crypto/engines/DESEngine.java | 476 |
work = right ^ wKey[round * 4 + 1]; fval |= SP8[ work & 0x3f]; fval |= SP6[(work >>> 8) & 0x3f]; fval |= SP4[(work >>> 16) & 0x3f]; fval |= SP2[(work >>> 24) & 0x3f]; |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/NcdPerfDataBean.java | 541 |
uk/co/westhawk/snmp/beans/NcdPerfDataBean.java | 746 |
typePdu.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } } else { |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/SnmpContextv3Basis.java | 1101 |
uk/co/westhawk/snmp/stack/SnmpContextv3Pool.java | 663 |
} /** * Returns the hash key. This key is built out of all properties. It * serves as key for a hashtable of (v3) contexts. * * @since 4_14 * @return The hash key */ public String getHashKey() { StringBuffer buffer = new StringBuffer(); buffer.append(hostname); buffer.append("_").append(hostPort); buffer.append("_").append(bindAddr); buffer.append("_").append(typeSocket); |
File | Line |
---|---|
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 570 |
uk/co/westhawk/snmp/beans/AnnexModemStatusBean.java | 598 |
uk/co/westhawk/snmp/beans/DialogChannelStatusBean.java | 579 |
uk/co/westhawk/snmp/beans/InterfaceIndexesBean.java | 274 |
uk/co/westhawk/snmp/beans/NTPrintQBean.java | 305 |
uk/co/westhawk/snmp/beans/NTServiceNamesBean.java | 303 |
uk/co/westhawk/snmp/beans/NTSharedResBean.java | 306 |
uk/co/westhawk/snmp/beans/NTUserNamesBean.java | 298 |
pduGet.send(); } catch (PduException exc) { System.out.println("PduException " + exc.getMessage()); } catch (IOException exc) { System.out.println("IOException " + exc.getMessage()); } } else { |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/AbstractSnmpContext.java | 335 |
uk/co/westhawk/snmp/stack/ListeningContext.java | 204 |
} public int getPort() { return hostPort; } public String getBindAddress() { return bindAddr; } public String getTypeSocket() { return typeSocket; } /** * Returns the maximum number of bytes this context will read from the * socket. By default this will be set to <code>MSS</code> (i.e. 1300). * * @since 4_12 * @see SnmpContextBasisFace#MSS * @see #setMaxRecvSize(int) * @return The number */ public int getMaxRecvSize() { return maxRecvSize; } /** * Sets the maximum number of bytes this context will read from the * socket. By default this will be set to <code>MSS</code> (i.e. 1300). * The default size seems a reasonable size. The problem usually occurs * when sending Bulk requests. * * <p> * If a packet arrives that is bigger than the maximum size of received * bytes, the stack will try to decode it nevertheless. The usual * error that will occur is: * </p> * <pre> * Error message: "Incorrect packet. No of bytes received less than packet length." * </pre> * * <p> * Although UDP datagrams can be fragmented (fragmentation is part of * the network layer (IP), not the transport layer (UDP/TCP)), some * firewalls reject incoming fragments. Therefor it is best not to set * maxRecvSize higher than the largest packet size you can get through * your network topology. * </p> * * <p> * Thanks to Pete Kazmier (pete@kazmier.com) for the suggestion. * </p> * * <em style="color:red;"> * Note, this property is NOT supported in any of the SNMPContextXXPool * classes. * </em> * * @since 4_12 * @see SnmpContextBasisFace#MSS * @see #getMaxRecvSize() * @param no The new number */ public void setMaxRecvSize(int no) { maxRecvSize = no; } /** * Returns the thread usage of the AbstractSnmpContext. * It returns a String in the form of <code>=PO=QR--------------0</code>. * * <p> * The String represents the array of transmitters. * Each character represents a transmitter slot. * The transmitters form a thread pool of a maximum size, MAXPDU. * Each transmitter is used to wait for one PDU response at a given * moment in time. * When the response is received the transmitter will stop running, but * is not destroyed. It will be reused. * </p> * * <p> * Meaning of each character: * </p> * <ul> * <li><code>-</code> a transmitter slot has not yet been allocated a thread</li> * <li><code>=</code> there is a thread but it is idle</li> * <li><code>A->Z</code> the thread is transmitting a Pdu</li> * <li> * The last character represents the context's recv thread: * <ul> * <li><code>0</code> there isn't one</li> * <li><code>1</code> it exists but isn't running </li> * <li><code>2</code> it exists and is alive.</li> * </ul> * </li> * </ul> * * @since 4_12 * @return The thread usage of the AbstractSnmpContext */ public String getDebugString() |
File | Line |
---|---|
uk/co/westhawk/snmp/stack/ListeningContextPool.java | 274 |
uk/co/westhawk/snmp/stack/ListeningContextPool.java | 408 |
Enumeration keys = copyOfPool.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); Item item = (Item) copyOfPool.get(key); if (item != null) { ListeningContext cntxt = (ListeningContext) item.getContext(); |
Search Results for {{siteSearch | truncate:'50'}}
{{resultArray.length}}
No results.