private SnmpPduPacket makeResponsePdu(SnmpPduPacket reqPdu,Object userData){
  SnmpAdaptorServer snmpServer=(SnmpAdaptorServer)adaptorServer;
  SnmpPduPacket respPdu=null;
  snmpServer.updateRequestCounters(reqPdu.type);
  if (reqPdu.varBindList != null)   snmpServer.updateVarCounters(reqPdu.type,reqPdu.varBindList.length);
  if (checkPduType(reqPdu)) {
    respPdu=checkAcl(reqPdu);
    if (respPdu == null) {
      if (mibs.size() < 1) {
        if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
          SNMP_ADAPTOR_LOGGER.logp(Level.FINER,dbgTag,"makeResponsePdu","Request " + reqPdu.requestId + " received but no MIB registered.");
        }
        return makeNoMibErrorPdu((SnmpPduRequest)reqPdu,userData);
      }
switch (reqPdu.type) {
case SnmpPduPacket.pduGetRequestPdu:
case SnmpPduPacket.pduGetNextRequestPdu:
case SnmpPduPacket.pduSetRequestPdu:
        respPdu=makeGetSetResponsePdu((SnmpPduRequest)reqPdu,userData);
      break;
case SnmpPduPacket.pduGetBulkRequestPdu:
    respPdu=makeGetBulkResponsePdu((SnmpPduBulk)reqPdu,userData);
  break;
}
}
 else {
if (!snmpServer.getAuthRespEnabled()) {
respPdu=null;
}
if (snmpServer.getAuthTrapEnabled()) {
try {
  snmpServer.snmpV1Trap(SnmpPduTrap.trapAuthenticationFailure,0,new SnmpVarBindList());
}
 catch (Exception x) {
  if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
    SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,dbgTag,"makeResponsePdu","Failure when sending authentication trap",x);
  }
}
}
}
}
return respPdu;
}

private SnmpPduPacket makeResponsePdu ( SnmpPduPacket reqPdu , Object userData ) { SnmpAdaptorServer snmpServer = ( SnmpAdaptorServer ) adaptorServer ; SnmpPduPacket respPdu = null ; snmpServer . updateRequestCounters ( reqPdu . type ) ; if ( reqPdu . varBindList != null ) snmpServer . updateVarCounters ( reqPdu . type , reqPdu . varBindList . length ) ; if ( checkPduType ( reqPdu ) ) { respPdu = checkAcl ( reqPdu ) ; if ( respPdu == null ) { if ( mibs . size ( ) < 1 ) { if ( SNMP_ADAPTOR_LOGGER . isLoggable ( Level . FINER ) ) { SNMP_ADAPTOR_LOGGER . logp ( Level . FINER , dbgTag , "makeResponsePdu" , "Request " + reqPdu . requestId + " received but no MIB registered." ) ; } return makeNoMibErrorPdu ( ( SnmpPduRequest ) reqPdu , userData ) ; } switch ( reqPdu . type ) { case SnmpPduPacket . pduGetRequestPdu : case SnmpPduPacket . pduGetNextRequestPdu : case SnmpPduPacket . pduSetRequestPdu : respPdu = makeGetSetResponsePdu ( ( SnmpPduRequest ) reqPdu , userData ) ; break ; case SnmpPduPacket . pduGetBulkRequestPdu : respPdu = makeGetBulkResponsePdu ( ( SnmpPduBulk ) reqPdu , userData ) ; break ; } } else { if ( ! snmpServer . getAuthRespEnabled ( ) ) { respPdu = null ; } if ( snmpServer . getAuthTrapEnabled ( ) ) { try { snmpServer . snmpV1Trap ( SnmpPduTrap . trapAuthenticationFailure , 0 , new SnmpVarBindList ( ) ) ; } catch ( Exception x ) { if ( SNMP_ADAPTOR_LOGGER . isLoggable ( Level . FINEST ) ) { SNMP_ADAPTOR_LOGGER . logp ( Level . FINEST , dbgTag , "makeResponsePdu" , "Failure when sending authentication trap" , x ) ; } } } } } return respPdu ; }
here we make a response pdu from a request pdu . we return null if there is no pdu to reply .
