#pragma once #include "CommanDefine.h" using namespace DIOS::Dev; class PacketAnalizer { public: PacketAnalizer(void); virtual ~PacketAnalizer(void); static DWORD GetPacketIdx(ResDataObject *pObj); static PACKET_TYPE GetPacketType(ResDataObject *pObj); static PACKET_CMD GetPacketCmd(ResDataObject *pObj); static string GetPacketKey(ResDataObject *pObj); static ResDataObject* GetPacketKeysRes(ResDataObject *pObj); static bool GetPacketHandleExistance(ResDataObject *pPacket); static bool GetPacketHandle(ResDataObject *pPacket,ResDataObject &Handle); static bool GetPacketHandleBusId(ResDataObject *pPacket, string &BusId,bool dev);//dev == false , Owner:Device static bool GetPacketHandleMachineId(ResDataObject *pPacket, string &MachineId, bool dev); static bool GetPacketHandleProcId(ResDataObject *pPacket, UINT64 &ProcId, bool dev); static bool GetPacketHandleAddr(ResDataObject *pPacket, UINT64 &Addr, bool dev); static bool GetDestinationMachineId(ResDataObject &packet, string &machineId); static bool GetDestinationBusId(ResDataObject &packet, string &busId); static bool GetDestinationProcId(ResDataObject &packet, UINT64 &procId); static bool GetPacketHandleCrc(ResDataObject *pPacket, UINT64 &Crc); static bool MakePacketContextExistance(ResDataObject *pPacket); static bool GetPacketRoute(ResDataObject *pPacket, DIOS_PACKET_ROUTE &Route); static bool GetPacketContext(ResDataObject *pPacket,ResDataObject &Context); static bool GetPacketRetCode(ResDataObject *pPacket,RET_STATUS &retcode); static bool GetPacketMsgInfo(ResDataObject *pPacket,string &Info); static bool CloneResponse(ResDataObject &Obj, ResDataObject *pReq); static DWORD MakePacketIdx(); static ACTION_SYNC_MODE GetPacketSyncMode(ResDataObject *pObj); static void MakeRetCode(RET_STATUS retcode,ResDataObject *pObj,const char *pMsg = NULL); static bool MakeResponseByReq(ResDataObject &Response, ResDataObject &Req, RET_STATUS ret, const char* pInfo = NULL); static void MakeNotify(ResDataObject &Obj, PACKET_CMD cmd, ResDataObject &Key, const ResDataObject &Context); static void MakeNotify(ResDataObject &Obj, PACKET_CMD cmd, const char *pKey, const ResDataObject &Context); static void MakeNotify(ResDataObject &Obj,PACKET_CMD cmd,const char *pKey,const char *pContext); static void MakeNotifyP2P(ResDataObject &Obj, PACKET_CMD cmd, ResDataObject *pReq, const char *pKey, const char *pContext); //static DWORD MakeActionRequest(ResDataObject &Obj,DiosDevFileHandle &handle,const char *pActionName,ResDataObject &ReqParams,ACTION_SYNC_MODE mode = ACTION_SYNC); //static DWORD MakeOpenRequest(ResDataObject &Obj,DiosDevFileHandle &handle,const char *pFilePath); static bool MakeOpenResponse(ResDataObject &Req, ResDataObject &Res, ResDataObject &DevResource); static bool MakeCloseNotifyByRes(ResDataObject &Response, ResDataObject &Req); static bool MakeCloseRequestByRes(ResDataObject &Response, ResDataObject &Req); //static bool MakeCloseRequest(ResDataObject &Obj, DiosDevFileHandle &handle, PACKET_TYPE Type = PACKET_TYPE_REQ); static bool MakeCloseResponse(ResDataObject &Req, ResDataObject &Res); static bool UpdatePacketRoute(ResDataObject &Obj, DIOS_PACKET_ROUTE Route); static bool UpdateOpenRequest(ResDataObject &Req, ResDataObject &MachineId, ResDataObject &busId, UINT64 ProcId, UINT64 Addr); //static bool UpdateNotifyHandle(ResDataObject &Obj, DiosDevFileHandle &handle); //static bool UpdateDeviceNotifyResponse(ResDataObject &Req, ResDataObject &MachineId, ResDataObject &busId, UINT64 ProcId, UINT64 Addr); static bool UpdatePacketContext(ResDataObject &packet, ResDataObject &Context); static bool GetParam(ResDataObject *pReq, unsigned int ParamIdx, ResDataObject &value); static bool AddParam(ResDataObject *pRes, unsigned int ParamIdx, ResDataObject &value); static bool UpdateParam(ResDataObject *pRes, unsigned int ParamIdx, ResDataObject &value); };