⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifmib.java

📁 你个snmp的源码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    ifRcvAddressEntryColumns[idxIfRcvAddressType] =      new Enumerated(colIfRcvAddressType,                     moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),                     new Integer32(2));    ValueConstraint ifRcvAddressTypeVC = new EnumerationConstraint(      new int[] { IfRcvAddressTypeEnum.other,                  IfRcvAddressTypeEnum._volatile,                  IfRcvAddressTypeEnum.nonVolatile });    ((MOMutableColumn)ifRcvAddressEntryColumns[idxIfRcvAddressType]).      addMOValueValidationListener(new ValueConstraintValidator(ifRcvAddressTypeVC));    ifRcvAddressEntryModel = new DefaultMOMutableTableModel();    ifRcvAddressEntryModel.setRowFactory(new IfRcvAddressEntryRowFactory());    ifRcvAddressEntry =      moFactory.createTable(oidIfRcvAddressEntry,                            ifRcvAddressEntryIndex,                            ifRcvAddressEntryColumns,                            ifRcvAddressEntryModel);  }  public void registerMOs(MOServer server, OctetString context)    throws DuplicateRegistrationException  {    // Scalar Objects    server.register(this.ifNumber, context);    server.register(this.ifTableLastChange, context);    server.register(this.ifStackLastChange, context);    server.register(this.ifEntry, context);    server.register(this.ifXEntry, context);    server.register(this.ifStackEntry, context);    server.register(this.ifTestEntry, context);    server.register(this.ifRcvAddressEntry, context);//--AgentGen BEGIN=_registerMOs//--AgentGen END  }  public void unregisterMOs(MOServer server, OctetString context) {    // Scalar Objects    server.unregister(this.ifNumber, context);    server.unregister(this.ifTableLastChange, context);    server.unregister(this.ifStackLastChange, context);    server.unregister(this.ifEntry, context);    server.unregister(this.ifXEntry, context);    server.unregister(this.ifStackEntry, context);    server.unregister(this.ifTestEntry, context);    server.unregister(this.ifRcvAddressEntry, context);//--AgentGen BEGIN=_unregisterMOs//--AgentGen END  }  // Notifications  public void linkDown(NotificationOriginator notificationOriginator,                         OctetString context, VariableBinding[] vbs) {    if (vbs.length < 3) {      throw new IllegalArgumentException("Too few notification objects: "+                                         vbs.length+"<3");    }    if (!(vbs[0].getOid().startsWith(oidTrapVarIfIndex))) {      throw new IllegalArgumentException("Variable 0 has wrong OID: "+vbs[0].getOid()+                                         " does not start with "+oidTrapVarIfIndex);    }    if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[0].getOid()))) {      throw new IllegalArgumentException("Illegal index for variable 0 specified: "+                                         ifEntry.getIndexPart(vbs[0].getOid()));    }    if (!(vbs[1].getOid().startsWith(oidTrapVarIfAdminStatus))) {      throw new IllegalArgumentException("Variable 1 has wrong OID: "+vbs[1].getOid()+                                         " does not start with "+oidTrapVarIfAdminStatus);    }    if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[1].getOid()))) {      throw new IllegalArgumentException("Illegal index for variable 1 specified: "+                                         ifEntry.getIndexPart(vbs[1].getOid()));    }    if (!(vbs[2].getOid().startsWith(oidTrapVarIfOperStatus))) {      throw new IllegalArgumentException("Variable 2 has wrong OID: "+vbs[2].getOid()+                                         " does not start with "+oidTrapVarIfOperStatus);    }    if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[2].getOid()))) {      throw new IllegalArgumentException("Illegal index for variable 2 specified: "+                                         ifEntry.getIndexPart(vbs[2].getOid()));    }    notificationOriginator.notify(context, oidLinkDown, vbs);  }  public void linkUp(NotificationOriginator notificationOriginator,                         OctetString context, VariableBinding[] vbs) {    if (vbs.length < 3) {      throw new IllegalArgumentException("Too few notification objects: "+                                         vbs.length+"<3");    }    if (!(vbs[0].getOid().startsWith(oidTrapVarIfIndex))) {      throw new IllegalArgumentException("Variable 0 has wrong OID: "+vbs[0].getOid()+                                         " does not start with "+oidTrapVarIfIndex);    }    if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[0].getOid()))) {      throw new IllegalArgumentException("Illegal index for variable 0 specified: "+                                         ifEntry.getIndexPart(vbs[0].getOid()));    }    if (!(vbs[1].getOid().startsWith(oidTrapVarIfAdminStatus))) {      throw new IllegalArgumentException("Variable 1 has wrong OID: "+vbs[1].getOid()+                                         " does not start with "+oidTrapVarIfAdminStatus);    }    if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[1].getOid()))) {      throw new IllegalArgumentException("Illegal index for variable 1 specified: "+                                         ifEntry.getIndexPart(vbs[1].getOid()));    }    if (!(vbs[2].getOid().startsWith(oidTrapVarIfOperStatus))) {      throw new IllegalArgumentException("Variable 2 has wrong OID: "+vbs[2].getOid()+                                         " does not start with "+oidTrapVarIfOperStatus);    }    if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[2].getOid()))) {      throw new IllegalArgumentException("Illegal index for variable 2 specified: "+                                         ifEntry.getIndexPart(vbs[2].getOid()));    }    notificationOriginator.notify(context, oidLinkUp, vbs);  }  // Scalars  // Value Validators  // Rows and Factories  class IfEntryRowFactory        extends DefaultMOMutableRow2PCFactory  {    public synchronized MOTableRow createRow(OID index, Variable[] values)        throws UnsupportedOperationException    {      IfEntryRow row = new IfEntryRow(index, values);     //--AgentGen BEGIN=ifEntry::createRow     //--AgentGen END      return row;    }    public synchronized void freeRow(MOTableRow row) {     //--AgentGen BEGIN=ifEntry::freeRow     //--AgentGen END    }  }  class IfEntryRow extends DefaultMOMutableRow2PC {    public IfEntryRow(OID index, Variable[] values) {      super(index, values);    }    public Integer32 getIfIndex() {      return (Integer32) getValue(idxIfIndex);    }    public void setIfIndex(Integer32 newValue) {      setValue(idxIfIndex, newValue);    }    public OctetString getIfDescr() {      return (OctetString) getValue(idxIfDescr);    }    public void setIfDescr(OctetString newValue) {      setValue(idxIfDescr, newValue);    }    public Integer32 getIfType() {      return (Integer32) getValue(idxIfType);    }    public void setIfType(Integer32 newValue) {      setValue(idxIfType, newValue);    }    public Integer32 getIfMtu() {      return (Integer32) getValue(idxIfMtu);    }    public void setIfMtu(Integer32 newValue) {      setValue(idxIfMtu, newValue);    }    public Gauge32 getIfSpeed() {      return (Gauge32) getValue(idxIfSpeed);    }    public void setIfSpeed(Gauge32 newValue) {      setValue(idxIfSpeed, newValue);    }    public OctetString getIfPhysAddress() {      return (OctetString) getValue(idxIfPhysAddress);    }    public void setIfPhysAddress(OctetString newValue) {      setValue(idxIfPhysAddress, newValue);    }    public Integer32 getIfAdminStatus() {      return (Integer32) getValue(idxIfAdminStatus);    }    public void setIfAdminStatus(Integer32 newValue) {      setValue(idxIfAdminStatus, newValue);    }    public Integer32 getIfOperStatus() {      return (Integer32) getValue(idxIfOperStatus);    }    public void setIfOperStatus(Integer32 newValue) {      setValue(idxIfOperStatus, newValue);    }    public TimeTicks getIfLastChange() {      return (TimeTicks) getValue(idxIfLastChange);    }    public void setIfLastChange(TimeTicks newValue) {      setValue(idxIfLastChange, newValue);    }    public Counter32 getIfInOctets() {      return (Counter32) getValue(idxIfInOctets);    }    public void setIfInOctets(Counter32 newValue) {      setValue(idxIfInOctets, newValue);    }    public Counter32 getIfInUcastPkts() {      return (Counter32) getValue(idxIfInUcastPkts);    }    public void setIfInUcastPkts(Counter32 newValue) {      setValue(idxIfInUcastPkts, newValue);    }    public Counter32 getIfInNUcastPkts() {      return (Counter32) getValue(idxIfInNUcastPkts);    }    public void setIfInNUcastPkts(Counter32 newValue) {      setValue(idxIfInNUcastPkts, newValue);    }    public Counter32 getIfInDiscards() {      return (Counter32) getValue(idxIfInDiscards);    }    public void setIfInDiscards(Counter32 newValue) {      setValue(idxIfInDiscards, newValue);    }    public Counter32 getIfInErrors() {      return (Counter32) getValue(idxIfInErrors);    }    public void setIfInErrors(Counter32 newValue) {      setValue(idxIfInErrors, newValue);    }    public Counter32 getIfInUnknownProtos() {      return (Counter32) getValue(idxIfInUnknownProtos);    }    public void setIfInUnknownProtos(Counter32 newValue) {      setValue(idxIfInUnknownProtos, newValue);    }    public Counter32 getIfOutOctets() {      return (Counter32) getValue(idxIfOutOctets);    }    public void setIfOutOctets(Counter32 newValue) {      setValue(idxIfOutOctets, newValue);    }    public Counter32 getIfOutUcastPkts() {      return (Counter32) getValue(idxIfOutUcastPkts);    }    public void setIfOutUcastPkts(Counter32 newValue) {      setValue(idxIfOutUcastPkts, newValue);    }    public Counter32 getIfOutNUcastPkts() {      return (Counter32) getValue(idxIfOutNUcastPkts);    }    public void setIfOutNUcastPkts(Counter32 newValue) {      setValue(idxIfOutNUcastPkts, newValue);    }    public Counter32 getIfOutDiscards() {      return (Counter32) getValue(idxIfOutDiscards);    }    public void setIfOutDiscards(Counter32 newValue) {      setValue(idxIfOutDiscards, newValue);    }    public Counter32 getIfOutErrors() {      return (Counter32) getValue(idxIfOutErrors);    }    public void setIfOutErrors(Counter32 newValue) {      setValue(idxIfOutErrors, newValue);    }    public Gauge32 getIfOutQLen() {      return (Gauge32) getValue(idxIfOutQLen);    }    public void setIfOutQLen(Gauge32 newValue) {      setValue(idxIfOutQLen, newValue);    }    public OID getIfSpecific() {      return (OID) getValue(idxIfSpecific);    }    public void setIfSpecific(OID newValue) {      setValue(idxIfSpecific, newValue);    }     //--AgentGen BEGIN=ifEntry::RowFactory     //--AgentGen END  }  class IfXEntryRowFactory        extends DefaultMOMutableRow2PCFactory  {    public synchronized MOTableRow createRow(OID index, Variable[] values)        throws UnsupportedOperationException    {      IfXEntryRow row = new IfXEntryRow(index, values);     //--AgentGen BEGIN=ifXEntry::createRow     //--AgentGen END      return row;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -