/***********************************************************************
 * 
 *  Copyright (C) 2006 Novell, Inc. All Rights Reserved.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; version 2.1
 *  of the License.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, Novell, Inc.
 * 
 *  To contact Novell about this file by physical or electronic mail, 
 *  you may find current contact information at www.novell.com.
 * 
 *  Author: Juan Carlos Luciani <jluciani@novell.com>
 *
 ***********************************************************************/


#ifndef _SERVERREQ_
#define _SERVERREQ_

//===[ Include files ]=====================================================

//===[ External data ]=====================================================

//===[ External prototypes ]===============================================

//===[ Manifest constants ]================================================

//===[ Type definitions ]==================================================

//===[ Function prototypes ]===============================================

//===[ Global variables ]==================================================

//===[ Type definitions ]==================================================

//
// Server Request Class
//
class ServerReq
{
   // Signature
   unsigned long           m_signature;

   // Id of request being processed
   uint32_t                m_reqId;

   // SmartSChannel object pointer for request being processed.
   SmartSChannel           *m_pSmartSChannel;

   // Request Client Data
   char                    *m_pClientData;
   int32_t                 m_clientDataLength;

public:

   //
   // Destructor
   ~ServerReq(void);

   //
   // Constructor
   //
   // Parameters:
   //    pSChannel (input) -
   //       Pointer to SChannel object.
   //
   //    reqId (input) -
   //       Request Id.
   //
   //    pClientData (input) -
   //       Pointer to buffer containing the client data.
   //       Buffer is released when the object is destroyed.
   //
   //    clientDataLength (input) -
   //       Length of the client data.
   //
   // Abstract: Constructs ServerReq object.
   //
   // Returns: Nothing.
   //
   ServerReq(SChannel *pSChannel,
             uint32_t reqId,
             char *pClientData,
             int32_t clientDataLength);

   //
   // Get request Data routine
   //
   // Parameters:
   //    ppClientData (input/output) -
   //       Pointer to variable that will receive pointer to
   //       data sent by the client. Buffer should NOT released by
   //       caller.
   //
   // Abstract: Sends the requests reply data to the client.
   //
   // Returns: The length of the client request data. 0 if not successful.
   //
   int getReqData(char **ppClientData);

   //
   // Complete Request routine
   //
   // Parameters:
   //    pServerData (input) -
   //       Pointer to server data that must be sent to
   //       the client. Buffer is NOT released by the
   //       procedure.
   //
   // Abstract: Completes the request.
   //
   // Returns: Nothing.
   //
   void complete(char *pServerData);

   //
   // Abort Request routine
   //
   // Parameters: None.
   //
   // Abstract: Aborts the request.
   //
   // Returns: Nothing.
   //
   void abort(void);
};


//===[ Function prototypes ]===============================================


#endif // _SERVERREQ_

//=========================================================================
//=========================================================================