org.snmp4j.smi.OID.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中org.snmp4j.smi.OID.<init>()方法的一些代码示例,展示了OID.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OID.<init>()方法的具体详情如下:
包路径:org.snmp4j.smi.OID
类名称:OID
方法名:<init>

OID.<init>介绍

[英]Constructs a zero length OID.
[中]构造一个零长度的OID。

代码示例

代码示例来源:origin: apache/nifi

/**
 * Will create an instance of {@link SNMPGetter}
 */
@Override
protected SNMPGetter finishBuildingTargetResource(ProcessContext context) {
  String oid = context.getProperty(OID).getValue();
  return new SNMPGetter(this.snmp, this.snmpTarget, new OID(oid));
}

代码示例来源:origin: apache/nifi

VariableBinding varBind = new VariableBinding(new OID(snmpPropName), var);
pdu.add(varBind);
result = true;

代码示例来源:origin: apache/cloudstack

private OID getOID(String oidString) {
    return new OID(oidString);
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

pdu1.setEnterprise( new OID( Oid ) );
pdu1.add( new VariableBinding( new OID( Oid ), new OctetString( messageString ) ) );
pdu.add( new VariableBinding( new OID( Oid ), new OctetString( messageString ) ) );
pdu.setType( PDU.TRAP );
if ( !Utils.isEmpty( engineID ) ) {

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws Exception {
   // Create PDU           
   PDU trap = new PDU();
   trap.setType(PDU.TRAP);

   OID oid = new OID("1.2.3.4.5");
   trap.add(new VariableBinding(SnmpConstants.snmpTrapOID, oid));
   trap.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(5000))); // put your uptime here
   trap.add(new VariableBinding(SnmpConstants.sysDescr, new OctetString("System Description"))); 

   //Add Payload
   Variable var = new OctetString("some string");          
   trap.add(new VariableBinding(oid, var));          

   // Specify receiver
   Address targetaddress = new UdpAddress("10.101.21.32/162");
   CommunityTarget target = new CommunityTarget();
   target.setCommunity(new OctetString("public"));
   target.setVersion(SnmpConstants.version2c);
   target.setAddress(targetaddress);

   // Send
   Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
   snmp.send(trap, target, null, null);                      
}

代码示例来源:origin: org.snmp4j/snmp4j-agent

public Variable createInitialValue() {
  Variable v = new OID();
  // further modify value to comply with TC constraints here:
 //--AgentGen BEGIN=TDomain::createInitialValue
 //--AgentGen END
  return v;
}

代码示例来源:origin: org.kaazing/snmp4j

/**
 * Creates a variable binding with a zero length OID and a {@link Null} value.
 */
public VariableBinding() {
 oid = new OID();
 this.variable = Null.instance;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

/**
 * Appends a dotted String OID to this {@code OID}.
 * @param oid
 *    a dotted String with numerical sub-identifiers.
 * @return
 *    a pointer to this OID instance (useful for chaining).
 */
public final OID append(String oid) {
 OID suffix = new OID(oid);
 return append(suffix);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

public OID toSubIndex(boolean impliedLength) {
 byte[] address = new byte[4];
 System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4);
 OID subIndex = new OID(new int[4]);
 for (int i=0; i<address.length; i++) {
  subIndex.set(i, address[i] & 0xFF);
 }
 return subIndex;
}

代码示例来源:origin: org.kaazing/snmp4j

/**
 * Appends a dotted String OID to this <code>OID</code>.
 * @param oid
 *    a dotted String with numerical sub-identifiers.
 * @return
 *    a pointer to this OID instance (useful for chaining).
 */
public final OID append(String oid) {
 OID suffix = new OID(oid);
 return append(suffix);
}

代码示例来源:origin: org.kaazing/snmp4j

public OID toSubIndex(boolean impliedLength) {
 byte[] address = new byte[4];
 System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4);
 OID subIndex = new OID(new int[4]);
 for (int i=0; i<address.length; i++) {
  subIndex.set(i, address[i] & 0xFF);
 }
 return subIndex;
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void addOid(SnmpObjId snmpObjId) {
  VariableBinding varBind = new VariableBinding(new OID(snmpObjId.getIds()));
  m_nextPdu.add(varBind);
}

代码示例来源:origin: org.snmp4j/snmp4j-agent

@Override
public OID getLowerBound() {
  if (lowerBound == null) {
    lowerBound = new OID(oid.getValue(), 0, oid.size() - 1);
  }
  return lowerBound;
}

代码示例来源:origin: org.snmp4j/snmp4j-agent

@Override
public int viewTreeFamilyEntryCount(OctetString viewName) {
 OID lowerBound = viewName.toSubIndex(false);
 OID upperBound = new OID(lowerBound).nextPeer();
 return vacmViewTreeFamilyTableModel.getRows(lowerBound, upperBound).size();
}

代码示例来源:origin: OpenNMS/opennms

public void put(String oid, Variable value) {
  OID oidKey = new OID(m_base);
  oidKey.append(oid);
  m_values.put(oidKey, value);
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void addVarBind(SnmpObjId name, SnmpValue value) {
  OID oid = new OID(name.getIds());
  Variable val = ((Snmp4JValue) value).getVariable();
  m_pdu.add(new VariableBinding(oid, val));
}

代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j

public void addVarBind(SnmpObjId name, SnmpValue value) {
  OID oid = new OID(name.getIds());
  Variable val = ((Snmp4JValue) value).getVariable();
  m_pdu.add(new VariableBinding(oid, val));
}

代码示例来源:origin: org.snmp4j/snmp4j-agent

public final OID getIndexPart(OID anyOID) {
  int offset = oid.size() + 1;
  if ((anyOID.size() <= offset) || (!anyOID.startsWith(oid))) {
    return null;
  }
  return new OID(anyOID.getValue(), offset, anyOID.size() - offset);
}

代码示例来源:origin: org.snmp4j/snmp4j-agent

private OID getCloneFromIndex(MOTableRow changeSet) {
 OID cloneFrom = (OID) changeSet.getValue(colUsmUserCloneFrom);
 if (cloneFrom == null) {
  cloneFrom = (OID) getValue(colUsmUserCloneFrom);
 }
 if ((cloneFrom == null) || (cloneFrom.size() <= usmUserEntryOID.size())) {
  return null;
 }
 return new OID(cloneFrom.getValue(), usmUserEntryOID.size()+1,
         cloneFrom.size() - (usmUserEntryOID.size()+1));
}

代码示例来源:origin: org.kaazing/snmp4j-agent

private OID getCloneFromIndex(MOTableRow changeSet) {
 OID cloneFrom = (OID) changeSet.getValue(colUsmUserCloneFrom);
 if (cloneFrom == null) {
  cloneFrom = (OID) getValue(colUsmUserCloneFrom);
 }
 if ((cloneFrom == null) || (cloneFrom.size() <= usmUserEntryOID.size())) {
  return null;
 }
 return new OID(cloneFrom.getValue(), usmUserEntryOID.size()+1,
         cloneFrom.size() - (usmUserEntryOID.size()+1));
}

相关文章