本文整理汇总了Java中org.opennms.protocols.snmp.SnmpOctetString类的典型用法代码示例。如果您正苦于以下问题:Java SnmpOctetString类的具体用法?Java SnmpOctetString怎么用?Java SnmpOctetString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SnmpOctetString类属于org.opennms.protocols.snmp包,在下文中一共展示了SnmpOctetString类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBytes
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public byte[] getBytes() {
switch (m_value.typeId()) {
case SnmpSMI.SMI_COUNTER64:
case SnmpSMI.SMI_INTEGER:
case SnmpSMI.SMI_COUNTER32:
case SnmpSMI.SMI_TIMETICKS:
case SnmpSMI.SMI_UNSIGNED32:
return toBigInteger().toByteArray();
case SnmpSMI.SMI_IPADDRESS:
return toInetAddress().getAddress();
case SnmpSMI.SMI_OBJECTID:
return ((SnmpObjectId)m_value).toString().getBytes();
case SnmpSMI.SMI_OPAQUE:
case SnmpSMI.SMI_STRING:
return ((SnmpOctetString)m_value).getString();
case SnmpSMI.SMI_ENDOFMIBVIEW:
case SnmpSMI.SMI_NOSUCHINSTANCE:
case SnmpSMI.SMI_NOSUCHOBJECT:
case SnmpSMI.SMI_NULL:
return new byte[0];
default:
throw new IllegalArgumentException("cannot convert "+m_value+" to a byte array");
}
}
示例2: getBytes
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public byte[] getBytes() {
switch (m_value.typeId()) {
case SnmpSMI.SMI_COUNTER64:
case SnmpSMI.SMI_INTEGER:
case SnmpSMI.SMI_COUNTER32:
case SnmpSMI.SMI_TIMETICKS:
case SnmpSMI.SMI_UNSIGNED32:
return toBigInteger().toByteArray();
case SnmpSMI.SMI_IPADDRESS:
return toInetAddress().getAddress();
case SnmpSMI.SMI_OBJECTID:
return ((SnmpObjectId)m_value).toString().getBytes();
case SnmpSMI.SMI_OPAQUE:
case SnmpSMI.SMI_STRING:
return ((SnmpOctetString)m_value).getString();
case SnmpSMI.SMI_NULL:
return new byte[0];
default:
throw new IllegalArgumentException("cannot convert "+m_value+" to a byte array");
}
}
示例3: toDisplayString
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public String toDisplayString() {
switch (m_value.typeId()) {
case SnmpSMI.SMI_TIMETICKS :
return Long.toString(toLong());
case SnmpSMI.SMI_STRING:
return SnmpOctetString.toDisplayString((SnmpOctetString)m_value);
default :
return m_value.toString();
}
}
示例4: toHexString
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public String toHexString() {
switch (m_value.typeId()) {
case SnmpSMI.SMI_STRING:
return SnmpOctetString.toHexString((SnmpOctetString)m_value);
default:
throw new IllegalArgumentException("cannt convert "+m_value+" to a HexString");
}
}
示例5: sendTest
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public static void sendTest(final String destAddr, final int destPort, final String community, final SnmpPduRequest pdu) throws UnknownHostException {
final InetAddress agentAddress = InetAddressUtils.getInetAddress(destAddr);
for (final RegistrationInfo info : s_registrations.values()) {
if (destPort == info.getPort()) {
info.getHandler().snmpReceivedTrap(info.getSession(), agentAddress, destPort, new SnmpOctetString(community.getBytes()), pdu);
}
}
}
示例6: getOctetString
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public SnmpValue getOctetString(byte[] bytes) {
return new JoeSnmpValue(new SnmpOctetString(bytes));
}
示例7: handleGet
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
SnmpVarBind outVar = new SnmpVarBind(oid);
SnmpSyntax value = new SnmpOctetString("Reliable Response Notification".getBytes());
outVar.setValue(value);
return outVar;
}
示例8: snmpReceivedPdu
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public void snmpReceivedPdu(SnmpAgentSession arg0, InetAddress arg1,
int arg2, SnmpOctetString arg3, SnmpPduPacket arg4) {
}
示例9: snmpReceivedTrap
import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
/**
* <P>
* Process the recieved SNMP v2c trap that was received by the underlying
* trap session.
* </P>
*
* @param session
* The trap session that received the datagram.
* @param agent
* The remote agent that sent the datagram.
* @param port
* The remmote port the trap was sent from.
* @param community
* The community string contained in the message.
* @param pdu
* The protocol data unit containing the data
*
*/
public void snmpReceivedTrap(SnmpTrapSession session, InetAddress agent,
int port, SnmpOctetString community, SnmpPduPacket pdu) {
m_listener.trapReceived(new V2TrapInformation(agent, new String(community.getString()), pdu, m_trapProcessorFactory.createTrapProcessor()));
}