• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SecurityModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.snmp4j.security.SecurityModel的典型用法代码示例。如果您正苦于以下问题:Java SecurityModel类的具体用法?Java SecurityModel怎么用?Java SecurityModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SecurityModel类属于org.snmp4j.security包,在下文中一共展示了SecurityModel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addNotificationTargets

import org.snmp4j.security.SecurityModel; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void addNotificationTargets(SnmpTargetMIB targetMIB,
        SnmpNotificationMIB notificationMIB) {
    targetMIB.addDefaultTDomains();

    targetMIB.addTargetAddress(new OctetString("notification"),
                               TransportDomains.transportDomainUdpIpv4,
                               new OctetString(new UdpAddress("127.0.0.1/162").getValue()),
                               200, 1,
                               new OctetString("notify"),
                               new OctetString("v2c"),
                               StorageType.permanent);
    targetMIB.addTargetParams(new OctetString("v2c"),
                              MessageProcessingModel.MPv2c,
                              SecurityModel.SECURITY_MODEL_SNMPv2c,
                              new OctetString("public"),
                              SecurityLevel.NOAUTH_NOPRIV,
                              StorageType.permanent);
    notificationMIB.addNotifyEntry(new OctetString("default"),
                                   new OctetString("notify"),
                                   SnmpNotificationMIB.SnmpNotifyTypeEnum.trap,
                                   StorageType.permanent);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:MockSnmpAgent.java


示例2: sendTest

import org.snmp4j.security.SecurityModel; //导入依赖的package包/类
public void sendTest(String agentAddress, int port, String community, PDU pdu) {
    for (RegistrationInfo info : s_registrations.values()) {
        if (port == info.getPort()) {
            Snmp snmp = info.getSession();
            MessageDispatcher dispatcher = snmp.getMessageDispatcher();
            TransportMapping transport = info.getTransportMapping();
            
            int securityModel = (pdu instanceof PDUv1 ? SecurityModel.SECURITY_MODEL_SNMPv1 :SecurityModel.SECURITY_MODEL_SNMPv2c);
            int messageModel = (pdu instanceof PDUv1 ? MessageProcessingModel.MPv1 : MessageProcessingModel.MPv2c);
            CommandResponderEvent e = new CommandResponderEvent(dispatcher, transport, new IpAddress(agentAddress), messageModel, 
                                                                securityModel, community.getBytes(), 
                                                                SecurityLevel.NOAUTH_NOPRIV, new PduHandle(), pdu, 1000, null);

            info.getHandler().processPdu(e);
        }
    }

}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:19,代码来源:Snmp4JStrategy.java


示例3: addViews

import org.snmp4j.security.SecurityModel; //导入依赖的package包/类
@Override
protected void addViews(final VacmMIB vacmMIB) {
    log.trace("adding views in the vacm MIB {} for agent \"{}\"", vacmMIB.toString(), configuration.getName());
    vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_SNMPv1, new OctetString(configuration.getCommunity()), new OctetString("v1v2group"), StorageType.nonVolatile);
    vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_SNMPv2c, new OctetString(configuration.getCommunity()), new OctetString("v1v2group"), StorageType.nonVolatile);
    vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_USM, new OctetString("SHADES"), new OctetString("v3group"), StorageType.nonVolatile);
    vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_USM, new OctetString("TEST"), new OctetString("v3test"), StorageType.nonVolatile);
    vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_USM, new OctetString("SHA"), new OctetString("v3restricted"), StorageType.nonVolatile);
    vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_USM, new OctetString("v3notify"), new OctetString("v3restricted"), StorageType.nonVolatile);

    // configure community index contexts
    for (final Long vlan : configuration.getDevice().getVlans()) {
        vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_SNMPv1, new OctetString(configuration.getCommunity() + "@" + vlan), new OctetString("v1v2group"), StorageType.nonVolatile);
        vacmMIB.addGroup(SecurityModel.SECURITY_MODEL_SNMPv2c, new OctetString(configuration.getCommunity() + "@" + vlan), new OctetString("v1v2group"), StorageType.nonVolatile);
        vacmMIB.addAccess(new OctetString("v1v2group"), new OctetString(String.valueOf(vlan)), SecurityModel.SECURITY_MODEL_ANY, SecurityLevel.NOAUTH_NOPRIV, MutableVACM.VACM_MATCH_EXACT, new OctetString("fullReadView"), new OctetString("fullWriteView"), new OctetString("fullNotifyView"), StorageType.nonVolatile);
    }

    vacmMIB.addAccess(new OctetString("v1v2group"), new OctetString(), SecurityModel.SECURITY_MODEL_ANY, SecurityLevel.NOAUTH_NOPRIV, MutableVACM.VACM_MATCH_EXACT, new OctetString("fullReadView"), new OctetString("fullWriteView"), new OctetString("fullNotifyView"), StorageType.nonVolatile);
    vacmMIB.addAccess(new OctetString("v3group"), new OctetString(), SecurityModel.SECURITY_MODEL_USM, SecurityLevel.AUTH_PRIV, MutableVACM.VACM_MATCH_EXACT, new OctetString("fullReadView"), new OctetString("fullWriteView"), new OctetString("fullNotifyView"), StorageType.nonVolatile);
    vacmMIB.addAccess(new OctetString("v3restricted"), new OctetString(), SecurityModel.SECURITY_MODEL_USM, SecurityLevel.NOAUTH_NOPRIV, MutableVACM.VACM_MATCH_EXACT, new OctetString("restrictedReadView"), new OctetString("restrictedWriteView"), new OctetString("restrictedNotifyView"), StorageType.nonVolatile);
    vacmMIB.addAccess(new OctetString("v3test"), new OctetString(), SecurityModel.SECURITY_MODEL_USM, SecurityLevel.AUTH_PRIV, MutableVACM.VACM_MATCH_EXACT, new OctetString("testReadView"), new OctetString("testWriteView"), new OctetString("testNotifyView"), StorageType.nonVolatile);

    vacmMIB.addViewTreeFamily(new OctetString("fullReadView"), new OID("1"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("fullWriteView"), new OID("1"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("fullNotifyView"), new OID("1"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);

    vacmMIB.addViewTreeFamily(new OctetString("restrictedReadView"), new OID("1.3.6.1.2"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("restrictedWriteView"), new OID("1.3.6.1.2.1"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("restrictedNotifyView"), new OID("1.3.6.1.2"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("restrictedNotifyView"), new OID("1.3.6.1.6.3.1"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);

    vacmMIB.addViewTreeFamily(new OctetString("testReadView"), new OID("1.3.6.1.2"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("testReadView"), new OID("1.3.6.1.2.1.1"), new OctetString(), VacmMIB.vacmViewExcluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("testWriteView"), new OID("1.3.6.1.2.1"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    vacmMIB.addViewTreeFamily(new OctetString("testNotifyView"), new OID("1.3.6.1.2"), new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
}
 
开发者ID:1and1,项目名称:snmpman,代码行数:37,代码来源:SnmpmanAgent.java


示例4: addViews

import org.snmp4j.security.SecurityModel; //导入依赖的package包/类
@Override
protected void addViews(VacmMIB vacm) {
	vacm.addGroup(SecurityModel.SECURITY_MODEL_SNMPv1,
			new OctetString("cpublic"),
			new OctetString("v1v2group"),
			StorageType.nonVolatile);

	vacm.addGroup(SecurityModel.SECURITY_MODEL_SNMPv2c,
			new OctetString("cpublic"),
			new OctetString("v1v2group"),
			StorageType.nonVolatile);

	vacm.addAccess(new OctetString("v1v2group"), new OctetString(community),
			SecurityModel.SECURITY_MODEL_ANY,
			SecurityLevel.NOAUTH_NOPRIV,
			MutableVACM.VACM_MATCH_EXACT,
			new OctetString("fullReadView"),
			new OctetString("fullWriteView"),
			new OctetString("fullNotifyView"),
			StorageType.nonVolatile);

	vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"),
			new OctetString(), VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);
	vacm.addViewTreeFamily(new OctetString("fullWriteView"), new OID("1.3"),
			new OctetString(), VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);
	vacm.addViewTreeFamily(new OctetString("fullNotifyView"), new OID("1.3"),
			new OctetString(), VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);

	vacm.addViewTreeFamily(new OctetString("restrictedReadView"),
			new OID("1.3.6.1.2"),
			new OctetString(), VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);
	vacm.addViewTreeFamily(new OctetString("restrictedWriteView"),
			new OID("1.3.6.1.2.1"),
			new OctetString(),
			VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);
	vacm.addViewTreeFamily(new OctetString("restrictedNotifyView"),
			new OID("1.3.6.1.2"),
			new OctetString(), VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);
	vacm.addViewTreeFamily(new OctetString("restrictedNotifyView"),
			new OID("1.3.6.1.6.3.1"),
			new OctetString(), VacmMIB.vacmViewIncluded,
			StorageType.nonVolatile);
}
 
开发者ID:wangzijian777,项目名称:snmpTool,代码行数:50,代码来源:MyAgent.java


示例5: addViews

import org.snmp4j.security.SecurityModel; //导入依赖的package包/类
/**
 * Adds initial VACM configuration.
 *
 * @param vacm
 *    the VacmMIB holding the agent's view configuration.
 */
@Override
protected void addViews(VacmMIB vacm) {
  super.addViews(vacm);

  if (communityStringIndexes == null || communityStringIndexes.size() == 0) {
    logger.info("No community string index. Add no view to VACM-MIB.");
    return;
  }

  if (getCommunityName() == null) {
    return;
  }

  for (String communityStringIndex: communityStringIndexes) {
    String communityName
      = getContextNameForCommunityStringIndex(communityStringIndex);

    vacm.addGroup(
      SecurityModel.SECURITY_MODEL_SNMPv1,
      new OctetString("com" + communityName),
      new OctetString("v1v2group"),
      StorageType.nonVolatile
    );
    vacm.addGroup(
      SecurityModel.SECURITY_MODEL_SNMPv2c,
      new OctetString("com" + communityName),
      new OctetString("v1v2group"),
      StorageType.nonVolatile
    );

    vacm.addAccess(
      new OctetString("v1v2group"),
      new OctetString(communityName),
      SecurityModel.SECURITY_MODEL_SNMPv1,
      SecurityLevel.NOAUTH_NOPRIV,
      MutableVACM.VACM_MATCH_EXACT,
      new OctetString("fullView"),
      new OctetString("fullView"),
      new OctetString("fullView"),
      StorageType.nonVolatile
    );
    vacm.addAccess(
      new OctetString("v1v2group"),
      new OctetString(communityName),
      SecurityModel.SECURITY_MODEL_SNMPv2c,
      SecurityLevel.NOAUTH_NOPRIV,
      MutableVACM.VACM_MATCH_EXACT,
      new OctetString("fullView"),
      new OctetString("fullView"),
      new OctetString("fullView"),
      StorageType.nonVolatile
    );
  }
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:61,代码来源:FileMibCiscoAgent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientboundMapItemDataPacket类代码示例发布时间:2022-05-22
下一篇:
Java DOMUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap