getLdapMessage() private method

private getLdapMessage ( Integer32 msgId ) : Object
msgId Integer32
return System.Object
        /// <summary> Private implementation of getResponse.
        /// Has an Integer object as a parameter so we can distinguish
        /// the null and the message number case
        /// </summary>
//		private LdapMessage getResponse(System.Int32 msgid)
        private LdapMessage getResponse(Integer32 msgid)
        {
            System.Object  resp;
            RfcLdapMessage message;
            LdapMessage    response;

            if ((resp = agent.getLdapMessage(msgid)) == null)
            {
                // blocks
                return(null); // no messages from this agent
            }
            // Local error occurred, contains a LocalException
            if (resp is LdapResponse)
            {
                return((LdapMessage)resp);
            }
            // Normal message handling
            message = (RfcLdapMessage)resp;
            switch (message.Type)
            {
            case LdapMessage.SEARCH_RESPONSE:
                response = new LdapSearchResult(message);
                break;

            case LdapMessage.SEARCH_RESULT_REFERENCE:
                response = new LdapSearchResultReference(message);
                break;

            case LdapMessage.EXTENDED_RESPONSE:
                ExtResponseFactory fac = new ExtResponseFactory();
                response = ExtResponseFactory.convertToExtendedResponse(message);
                break;

            case LdapMessage.INTERMEDIATE_RESPONSE:
                response = IntermediateResponseFactory.convertToIntermediateResponse(message);
                break;

            default:
                response = new LdapResponse(message);
                break;
            }
            return(response);
        }