#ifndef __CMessaging_h__
#define __CMessaging_h__ 1
#include <DirectoryServiceCore/PrivateTypes.h>
#include <DirectoryServiceCore/SharedConsts.h>
#include <DirectoryService/DirServicesTypes.h>
#include <DirectoryServiceCore/DSMutexSemaphore.h>
class CMessaging {
public:
CMessaging ( CIPCVirtualClass *inEndPoint, int inTranslateMode, bool internal = true );
virtual ~CMessaging ( void );
SInt32 Add_tDataBuff_ToMsg ( tDataBuffer *inBuff, eValueType inType );
SInt32 Add_tDataList_ToMsg ( tDataList *inList, eValueType inType );
SInt32 Add_Value_ToMsg ( UInt32 inValue, eValueType inType );
SInt32 Add_tAttrEntry_ToMsg ( tAttributeEntry *inData );
SInt32 Add_tAttrValueEntry_ToMsg ( tAttributeValueEntry *inData );
SInt32 Add_tRecordEntry_ToMsg ( tRecordEntry *inData );
SInt32 Get_tDataBuff_FromMsg ( tDataBuffer **outBuff, eValueType inType );
SInt32 Get_tDataList_FromMsg ( tDataList **outList, eValueType inType );
SInt32 Get_Value_FromMsg ( UInt32 *outValue, eValueType inType );
SInt32 Get_tAttrEntry_FromMsg ( tAttributeEntry **outAttrEntry, eValueType inType );
SInt32 Get_tAttrValueEntry_FromMsg ( tAttributeValueEntry **outAttrValue, eValueType inType );
SInt32 Get_tRecordEntry_FromMsg ( tRecordEntry **outRecEntry, eValueType inType );
SInt32 SendInlineMessage ( UInt32 inMsgType );
SInt32 GetReplyMessage ( void );
void CloseConnection ( void ) { if ( fCommPort != NULL ) fCommPort->Disconnect(); }
void Lock ( void );
void Unlock ( void );
void ClearMessageBlock ( void );
UInt32 GetServerVersion ( void );
void SetServerVersion ( UInt32 inServerVersion );
void ResetMessageBlock ( void );
void SetTranslateMode ( int inTranslateMode ) { fTranslateMode = inTranslateMode; }
int GetTranslateMode ( void ) { return fTranslateMode; }
#ifdef SERVERINTERNAL
bool IsThreadUsingInternalDispatchBuffering( UInt32 inThreadSig );
#endif
private:
SInt32 GetEmptyObj ( sComData *inMsg, eValueType inType, sObject **outObj );
SInt32 GetThisObj ( sComData *inMsg, eValueType inType, sObject **outObj );
sComData* GetMsgData ( void );
bool Grow ( UInt32 inOffset, UInt32 inSize );
CIPCVirtualClass *fCommPort;
int fTranslateMode;
bool fInternal;
DSMutexSemaphore fLock;
sComData *fMsgData;
UInt32 fServerVersion;
};
#endif