public int getSecurityLevel() { return m_config.getSecurityLevel(); }
public int getSecurityLevel() { return m_config.getSecurityLevel(); }
public int getSecurityLevel() { return m_config.getSecurityLevel(); }
public int getSecurityLevel() { return convertSecurityLevel(m_config.getSecurityLevel()); }
public int getSecurityLevel() { return convertSecurityLevel(m_config.getSecurityLevel()); }
public int getSecurityLevel() { return convertSecurityLevel(m_config.getSecurityLevel()); }
public Map<String, String> toMap() { Map<String, String> map = new LinkedHashMap<>(); map.put("address", m_address == null ? null : InetAddrUtils.str(m_address)); map.put("proxyFor", m_proxyFor == null ? null : InetAddrUtils.str(m_proxyFor)); map.put("port", Integer.toString(getPort())); map.put("timeout", Integer.toString(getTimeout())); map.put("retries", Integer.toString(getRetries())); map.put("max-vars-per-pdu", Integer.toString(getMaxVarsPerPdu())); map.put("max-repetitions", Integer.toString(getMaxRepetitions())); map.put("max-request-size", Integer.toString(getMaxRequestSize())); map.put("version", Integer.toString(getVersion())); map.put("security-level", Integer.toString(getSecurityLevel())); map.put("security-name", getSecurityName()); map.put("auth-passphrase", getAuthPassPhrase()); map.put("auth-protocol", getAuthProtocol()); map.put("priv-passphrase", getPrivPassPhrase()); map.put("priv-protocol", getPrivProtocol()); map.put("context-name", getContextName()); map.put("engine-id", getEngineId()); map.put("context-engine-id", getContextEngineId()); map.put("enterprise-id", getEnterpriseId()); map.put("read-community", getReadCommunity()); map.put("write-community", getWriteCommunity()); return map; }
buff.append(", Version: " + versionToString(getVersion())); if (isVersion3()) { buff.append(", SecurityLevel: " + getSecurityLevel()); buff.append(", SecurityName: " + getSecurityName()); buff.append(", AuthPassPhrase: XXXXXXXX"); //getAuthPassPhrase()
public String toString() { StringBuffer buff = new StringBuffer("AgentConfig["); buff.append("Address: "+getAddress()); buff.append(", ProxyForAddress: "+getProxyFor()); buff.append(", Port: "+getPort()); buff.append(", Community: "+getReadCommunity()); buff.append(", Timeout: "+getTimeout()); buff.append(", Retries: "+getRetries()); buff.append(", MaxVarsPerPdu: "+getMaxVarsPerPdu()); buff.append(", MaxRepetitions: "+getMaxRepetitions()); buff.append(", Max request size: "+getMaxRequestSize()); buff.append(", Version: "+versionToString(getVersion())); if (getVersion() == VERSION3) { buff.append(", Security level: "+getSecurityLevel()); buff.append(", Security name: "+getSecurityName()); buff.append(", auth-passphrase: "+getAuthPassPhrase()); buff.append(", auth-protocol: "+getAuthProtocol()); buff.append(", priv-passprhase: "+getPrivPassPhrase()); buff.append(", priv-protocol: "+getPrivProtocol()); } buff.append("]"); return buff.toString(); }
System.out.println("SecurityLevel: " + agent.getSecurityLevel()); System.out.println("SecurityName: " + agent.getSecurityName()); System.out.println("AuthPassPhrase: " + agent.getAuthPassPhrase());
&& Objects.equals(getMaxVarsPerPdu(), other.getMaxVarsPerPdu()) && Objects.equals(getVersion(), other.getVersion()) && Objects.equals(getSecurityLevel(), other.getSecurityLevel()) && Objects.equals(getSecurityName(), other.getSecurityName()) && Objects.equals(getAuthPassPhrase(), other.getAuthPassPhrase())
/** * Create an SNMP V3 trap based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV3Trap(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV3TrapBuilder trap = SnmpUtils.getV3TrapBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.send(config.getAddress().getHostAddress(), config.getPort(), config.getSecurityLevel(), config.getSecurityName(), config.getAuthPassPhrase(), config.getAuthProtocol(), config.getPrivPassPhrase(), config.getPrivProtocol()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
/** * Create an SNMP V3 inform based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV3Inform(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV3TrapBuilder trap = SnmpUtils.getV3InformBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.sendInform(config.getAddress().getHostAddress(), config.getPort(), config.getTimeout(), config.getTimeout(), config.getSecurityLevel(), config.getSecurityName(), config.getAuthPassPhrase(), config.getAuthProtocol(), config.getPrivPassPhrase(), config.getPrivProtocol()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
overhead += trapConfig.getEnterpriseId().length() + 14; // Trap-OID Varbind if (trapConfig.getVersion().isV3()) { switch (agentConfig.getSecurityLevel()) { case 1: overhead += 92; break; case 2: overhead += 120; break;
@Override public int hashCode() { int hash = Objects.hash(getAddress(), getProxyFor(), getPort(), getTimeout(), getRetries(), getMaxVarsPerPdu(), getMaxRepetitions(), getMaxRequestSize(), getVersion(), getSecurityLevel(), getSecurityName(), getAuthPassPhrase(), getAuthProtocol(), getPrivPassPhrase(), getPrivProtocol(), getContextName(), getEngineId(), getContextEngineId(), getEnterpriseId(), getReadCommunity(), getWriteCommunity()); return hash; }
m_securityLevel = Integer.valueOf(config.getSecurityLevel()); m_authPassPhrase = config.getAuthPassPhrase(); m_authProtocol = config.getAuthProtocol();
m_securityLevel = Integer.valueOf(config.getSecurityLevel()); m_authPassPhrase = config.getAuthPassPhrase(); m_authProtocol = config.getAuthProtocol();