Java 类com.sun.jmx.snmp.SnmpTimeticks 实例源码

项目:OpenJSharp    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk8u-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk8u_jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:lookaside_java-1.8.0-openjdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:infobip-open-jdk-8    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk8u-dev-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:OLD-OpenJDK8    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:OpenJSharp    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:OpenJSharp    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:OpenJSharp    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:jdk8u-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk8u-jdk    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:jdk8u-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:jdk8u_jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk8u_jdk    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:jdk8u_jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:lookaside_java-1.8.0-openjdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:lookaside_java-1.8.0-openjdk    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:lookaside_java-1.8.0-openjdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:infobip-open-jdk-8    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:infobip-open-jdk-8    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:infobip-open-jdk-8    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:jdk8u-dev-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk8u-dev-jdk    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:jdk8u-dev-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:jdk7-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk7-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:jdk7-jdk    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:openjdk-source-code-learn    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:openjdk-source-code-learn    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:openjdk-source-code-learn    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:OLD-OpenJDK8    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:OLD-OpenJDK8    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:OLD-OpenJDK8    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
项目:openjdk-jdk7u-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param cs The community string to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(InetAddress addr,
                       SnmpIpAddress agentAddr,
                       String cs,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    snmpV1Trap(addr,
               trapPort,
               agentAddr,
               cs,
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:openjdk-jdk7u-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
项目:openjdk-jdk7u-jdk    文件:SnmpAdaptorServer.java   
private void snmpV1Trap(InetAddress addr,
                        int port,
                        SnmpIpAddress agentAddr,
                        String cs,
                        SnmpOid enterpOid,
                        int generic,
                        int specific,
                        SnmpVarBindList varBindList,
                        SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic + ", specific=" +
              specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = port ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;

    //Diff start
    if(cs != null)
        pdu.community = cs.getBytes();
    else
        pdu.community = null ;
    //Diff end

    // Diff start
    if(enterpOid != null)
        pdu.enterprise = enterpOid;
    else
        pdu.enterprise = enterpriseOid ;
    //Diff end
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    //Diff start
    if(time != null)
        pdu.timeStamp = time.longValue();
    else
        pdu.timeStamp = getSysUpTime();
    //Diff end

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    if (agentAddr == null) {
        // If the local host cannot be determined,
        // we put 0.0.0.0 in agentAddr
        try {
            final InetAddress inetAddr =
                (address!=null)?address:InetAddress.getLocalHost();
            agentAddr = handleMultipleIpVersion(inetAddr.getAddress());
        }  catch (UnknownHostException e) {
            byte[] zeroedAddr = new byte[4];
            agentAddr = handleMultipleIpVersion(zeroedAddr);
        }
    }

    pdu.agentAddr = agentAddr;

    // Next, send the pdu to the specified destination
    //
    // Diff start
    if(addr != null)
        sendTrapPdu(addr, pdu) ;
    else
        sendTrapPdu(pdu);

    //End diff
}
项目:OpenJSharp    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 * <BR>The variable list included in the outgoing trap is composed of the
 * following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param cs The community string to be used for the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV2Trap(InetAddress addr,
                       String cs,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    snmpV2Trap(addr,
               trapPort,
               cs,
               trapOid,
               varBindList,
               time);
}
项目:OpenJSharp    文件:SnmpAdaptorServerMBean.java   
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time) throws IOException, SnmpStatusException;
项目:jdk8u-jdk    文件:SnmpAdaptorServer.java   
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
 * destination using the specified parameters (and the ACL file is not
 * used).
 * Note that if the specified <CODE>InetAddress</CODE> destination is null,
 * then the ACL file mechanism is used.
 * <BR>The variable list included in the outgoing trap is composed of the
 * following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param addr The <CODE>InetAddress</CODE> destination of the trap.
 * @param cs The community string to be used for the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV2Trap(InetAddress addr,
                       String cs,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    snmpV2Trap(addr,
               trapPort,
               cs,
               trapOid,
               varBindList,
               time);
}