public Object clone() { return new IpAddress(inetAddress); }
public Object clone() { return new IpAddress(inetAddress); }
public Object clone() { return new IpAddress(inetAddress); }
/** * Create a new TrapPduHelper * * @param dateFormat * The date format to use */ public TrapPduHelper(String dateFormat) { address= new IpAddress(Constants.localHostAddr); formatter= new SimpleDateFormat(dateFormat, Locale.ENGLISH); }
@Override public SnmpValue getIpAddress(InetAddress val) { return new Snmp4JValue(new IpAddress(val)); }
@Override public SnmpValue getIpAddress(InetAddress val) { return new Snmp4JValue(new IpAddress(val)); }
public SnmpValue getIpAddress(InetAddress val) { return new Snmp4JValue(new IpAddress(val)); }
/** * Parses an IP address string and returns the corresponding * <code>IpAddress</code> instance. * @param address * an IP address string which may be a host name or a numerical IP address. * @return * an <code>IpAddress</code> instance or <code>null</code> if * <code>address</code> cannot not be parsed. * @see Address#parseAddress(String address) */ public static Address parse(String address) { try { InetAddress addr = InetAddress.getByName(address); return new IpAddress(addr); } catch (Exception ex) { logger.error("Unable to parse IpAddress from: "+address, ex); return null; } }
/** * Parses an IP address string and returns the corresponding * <code>IpAddress</code> instance. * @param address * an IP address string which may be a host name or a numerical IP address. * @return * an <code>IpAddress</code> instance or <code>null</code> if * <code>address</code> cannot not be parsed. * @see Address#parseAddress(String address) */ public static Address parse(String address) { try { InetAddress addr = InetAddress.getByName(address); return new IpAddress(addr); } catch (Exception ex) { logger.error("Unable to parse IpAddress from: "+address, ex); return null; } }
/** * Parses an IP address string and returns the corresponding * <code>IpAddress</code> instance. * @param address * an IP address string which may be a host name or a numerical IP address. * @return * an <code>IpAddress</code> instance or <code>null</code> if * <code>address</code> cannot not be parsed. * @see Address#parseAddress(String address) */ public static Address parse(String address) { try { InetAddress addr = InetAddress.getByName(address); return new IpAddress(addr); } catch (Exception ex) { logger.error("Unable to parse IpAddress from: "+address, ex); return null; } }
@Override public void setAgentAddress(InetAddress agentAddress) { getPDUv1().setAgentAddress(new IpAddress(agentAddress)); }
@Override public void setAgentAddress(InetAddress agentAddress) { getPDUv1().setAgentAddress(new IpAddress(agentAddress)); }
public void setAgentAddress(InetAddress agentAddress) { getPDUv1().setAgentAddress(new IpAddress(agentAddress)); }
public void sendTest(String agentAddress, int port, String community, PDU pdu) { for (RegistrationInfo info : s_registrations.values()) { if (port == info.getPort()) { Snmp snmp = info.getSession(); MessageDispatcher dispatcher = snmp.getMessageDispatcher(); TransportMapping transport = info.getTransportMapping(); int securityModel = (pdu instanceof PDUv1 ? SecurityModel.SECURITY_MODEL_SNMPv1 :SecurityModel.SECURITY_MODEL_SNMPv2c); int messageModel = (pdu instanceof PDUv1 ? MessageProcessingModel.MPv1 : MessageProcessingModel.MPv2c); CommandResponderEvent e = new CommandResponderEvent(dispatcher, transport, new IpAddress(agentAddress), messageModel, securityModel, community.getBytes(), SecurityLevel.NOAUTH_NOPRIV, new PduHandle(), pdu, 1000, null); info.getHandler().processPdu(e); } } }
public void sendTest(String agentAddress, int port, String community, PDU pdu) { for (RegistrationInfo info : s_registrations.values()) { if (port == info.getPort()) { final Snmp snmp = info.getSession(); Snmp4JStrategy.trackSession(snmp); MessageDispatcher dispatcher = snmp.getMessageDispatcher(); TransportMapping<UdpAddress> transport = info.getTransportMapping(); int securityModel = (pdu instanceof PDUv1 ? SecurityModel.SECURITY_MODEL_SNMPv1 :SecurityModel.SECURITY_MODEL_SNMPv2c); int messageModel = (pdu instanceof PDUv1 ? MessageProcessingModel.MPv1 : MessageProcessingModel.MPv2c); CommandResponderEvent e = new CommandResponderEvent(dispatcher, transport, new IpAddress(agentAddress), messageModel, securityModel, community.getBytes(), SecurityLevel.NOAUTH_NOPRIV, new PduHandle(), pdu, 1000, null); info.getHandler().processPdu(e); } } }
public void sendTest(String agentAddress, int port, String community, PDU pdu) { for (RegistrationInfo info : s_registrations.values()) { if (port == info.getPort()) { final Snmp snmp = info.getSession(); Snmp4JStrategy.trackSession(snmp); MessageDispatcher dispatcher = snmp.getMessageDispatcher(); TransportMapping<UdpAddress> transport = info.getTransportMapping(); int securityModel = (pdu instanceof PDUv1 ? SecurityModel.SECURITY_MODEL_SNMPv1 :SecurityModel.SECURITY_MODEL_SNMPv2c); int messageModel = (pdu instanceof PDUv1 ? MessageProcessingModel.MPv1 : MessageProcessingModel.MPv2c); CommandResponderEvent e = new CommandResponderEvent(dispatcher, transport, new IpAddress(agentAddress), messageModel, securityModel, community.getBytes(), SecurityLevel.NOAUTH_NOPRIV, new PduHandle(), pdu, 1000, null); info.getHandler().processPdu(e); } } }
private static PDU createPdu(int snmpVersion) { PDU pdu = DefaultPDUFactory.createPDU(snmpVersion); if (snmpVersion == SnmpConstants.version1) { pdu.setType(PDU.V1TRAP); } else { pdu.setType(PDU.TRAP); } pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(1000))); pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(trapOid))); pdu.add(new VariableBinding(SnmpConstants.snmpTrapAddress, new IpAddress(ipAddress))); pdu.add(new VariableBinding(new OID(trapOid), new OctetString("Major"))); return pdu; }
return new IpAddress();
return new IpAddress(subIndex.toString());
return new IpAddress(subIndex.toString());