当前位置: 首页>>代码示例>>Java>>正文


Java SnmpOctetString类代码示例

本文整理汇总了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");
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:JoeSnmpValue.java

示例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");
    }
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:22,代码来源:JoeSnmpValue.java

示例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();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:12,代码来源:JoeSnmpValue.java

示例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");
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:JoeSnmpValue.java

示例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);
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:JoeSnmpStrategy.java

示例6: getOctetString

import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public SnmpValue getOctetString(byte[] bytes) {
    return new JoeSnmpValue(new SnmpOctetString(bytes));
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:JoeSnmpValueFactory.java

示例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;
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:7,代码来源:SNMPSysNameGetHandler.java

示例8: snmpReceivedPdu

import org.opennms.protocols.snmp.SnmpOctetString; //导入依赖的package包/类
public void snmpReceivedPdu(SnmpAgentSession arg0, InetAddress arg1,
		int arg2, SnmpOctetString arg3, SnmpPduPacket arg4) {
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:4,代码来源:SNMPLibrary.java

示例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()));
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:23,代码来源:JoeSnmpTrapNotifier.java


注:本文中的org.opennms.protocols.snmp.SnmpOctetString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。