2006-09-01 01:05:25 +02:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
//===[ Include files ]=====================================================
|
|
|
|
|
|
|
|
#include "ipcint.h"
|
|
|
|
#include "schannel.h"
|
|
|
|
#include "serverreq.h"
|
|
|
|
#include <assert.h> // Ensure that NDEBUG is defined for release builds!
|
|
|
|
|
|
|
|
//===[ External data ]=====================================================
|
|
|
|
|
|
|
|
//===[ External prototypes ]===============================================
|
|
|
|
|
|
|
|
//===[ Manifest constants ]================================================
|
|
|
|
|
|
|
|
#define SERVER_REQ_SIGNATURE 0x52525653 // SVRR
|
|
|
|
|
|
|
|
//===[ Type definitions ]==================================================
|
|
|
|
|
|
|
|
//===[ Function prototypes ]===============================================
|
|
|
|
|
|
|
|
//===[ Global variables ]==================================================
|
|
|
|
|
|
|
|
//===[ Type definitions ]==================================================
|
|
|
|
|
|
|
|
//===[ Function prototypes ]===============================================
|
|
|
|
|
|
|
|
//===[ Global variables ]==================================================
|
|
|
|
|
|
|
|
//
|
|
|
|
// Object Counters
|
|
|
|
//
|
|
|
|
unsigned long numServerReqObjects = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//++=======================================================================
|
|
|
|
ServerReq::ServerReq(
|
|
|
|
SChannel *pSChannel,
|
|
|
|
uint32_t reqId,
|
|
|
|
char *pClientData,
|
|
|
|
int32_t clientDataLength) :
|
|
|
|
|
|
|
|
m_signature (SERVER_REQ_SIGNATURE),
|
|
|
|
m_reqId (reqId),
|
|
|
|
m_pClientData (pClientData),
|
|
|
|
m_clientDataLength (clientDataLength)
|
|
|
|
//
|
|
|
|
// Arguments:
|
|
|
|
//
|
|
|
|
// Returns:
|
|
|
|
//
|
|
|
|
// Abstract:
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
//
|
|
|
|
// L2
|
|
|
|
//=======================================================================--
|
|
|
|
{
|
|
|
|
DbgTrace(1, "ServerReq::ServerReq- Start, Obj = %08X\n", this);
|
|
|
|
|
|
|
|
// Create a SmartSChannel object to keep the SChannel object from
|
|
|
|
// going away while we process the request.
|
|
|
|
m_pSmartSChannel = new SmartSChannel(pSChannel);
|
|
|
|
|
|
|
|
// Increment the object count
|
|
|
|
InterlockedIncrement(&numServerReqObjects);
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::ServerReq- End\n", 0);
|
|
|
|
|
|
|
|
} /*-- ServerReq::ServerReq() --*/
|
|
|
|
|
|
|
|
|
|
|
|
//++=======================================================================
|
|
|
|
ServerReq::~ServerReq(void)
|
|
|
|
//
|
|
|
|
// Arguments:
|
|
|
|
//
|
|
|
|
// Returns:
|
|
|
|
//
|
|
|
|
// Abstract:
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
//
|
|
|
|
// L2
|
|
|
|
//=======================================================================--
|
|
|
|
{
|
|
|
|
DbgTrace(1, "ServerReq::~ServerReq- Start, Obj = %08X\n", this);
|
|
|
|
|
|
|
|
// Free any client data that may be hanging around
|
|
|
|
if (m_pClientData)
|
|
|
|
free(m_pClientData);
|
|
|
|
|
2006-09-02 00:53:10 +02:00
|
|
|
// Delete the SmartSChannel
|
|
|
|
delete m_pSmartSChannel;
|
|
|
|
|
2006-09-01 01:05:25 +02:00
|
|
|
// Decrement the object count
|
|
|
|
InterlockedDecrement(&numServerReqObjects);
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::~ServerReq- End\n", 0);
|
|
|
|
|
|
|
|
} /*-- ServerReq::~ServerReq() --*/
|
|
|
|
|
|
|
|
|
|
|
|
//++=======================================================================
|
|
|
|
int
|
|
|
|
ServerReq::getReqData(
|
|
|
|
char **ppClientData)
|
|
|
|
//
|
|
|
|
// Arguments:
|
|
|
|
//
|
|
|
|
// Returns:
|
|
|
|
//
|
|
|
|
// Abstract:
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
//
|
|
|
|
// L2
|
|
|
|
//=======================================================================--
|
|
|
|
{
|
|
|
|
DbgTrace(1, "ServerReq::getReqData- Start, Obj = %08X\n", this);
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
assert(m_signature == SERVER_REQ_SIGNATURE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Return pointer to the client data
|
|
|
|
*ppClientData = m_pClientData;
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::getReqData- End, reqDataLen = %08X\n", m_clientDataLength);
|
|
|
|
|
|
|
|
return m_clientDataLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//++=======================================================================
|
|
|
|
void
|
|
|
|
ServerReq::complete(
|
|
|
|
char *pServerData)
|
|
|
|
//
|
|
|
|
// Arguments:
|
|
|
|
//
|
|
|
|
// Returns:
|
|
|
|
//
|
|
|
|
// Abstract:
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
//
|
|
|
|
// L2
|
|
|
|
//=======================================================================--
|
|
|
|
{
|
|
|
|
SChannel *pSChannel = *m_pSmartSChannel;
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::complete- Start, Obj = %08X\n", this);
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
assert(m_signature == SERVER_REQ_SIGNATURE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Send data to the client
|
|
|
|
pSChannel->sendReplyData(m_reqId,
|
|
|
|
pServerData,
|
|
|
|
strlen(pServerData));
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::complete- End\n", 0);
|
|
|
|
|
|
|
|
} /*-- ServerReq::complete() --*/
|
|
|
|
|
|
|
|
|
|
|
|
//++=======================================================================
|
|
|
|
void
|
|
|
|
ServerReq::abort(void)
|
|
|
|
//
|
|
|
|
// Arguments:
|
|
|
|
//
|
|
|
|
// Returns:
|
|
|
|
//
|
|
|
|
// Abstract:
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
//
|
|
|
|
// L2
|
|
|
|
//=======================================================================--
|
|
|
|
{
|
|
|
|
SChannel *pSChannel = *m_pSmartSChannel;
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::abort- Start, Obj = %08X\n", this);
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
assert(m_signature == SERVER_REQ_SIGNATURE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Send an error to the client
|
|
|
|
pSChannel->sendReplyError(m_reqId);
|
|
|
|
|
|
|
|
DbgTrace(1, "ServerReq::abort- End\n", 0);
|
|
|
|
|
|
|
|
} /*-- ServerReq::abort() --*/
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
//=========================================================================
|
|
|
|
|