Expose the total number of sections via ICaptureAccess

* This lets external code iterate over all sections.
This commit is contained in:
baldurk
2017-12-20 17:17:41 +00:00
parent cb4fb770e9
commit 669fa9dc40
3 changed files with 61 additions and 1 deletions
+45 -1
View File
@@ -35,7 +35,7 @@
#include "strings/string_utils.h"
#include "replay_proxy.h"
static const uint32_t RemoteServerProtocolVersion = 2;
static const uint32_t RemoteServerProtocolVersion = 3;
enum RemoteServerPacket
{
@@ -61,6 +61,7 @@ enum RemoteServerPacket
eRemoteServer_ListDir,
eRemoteServer_ExecuteAndInject,
eRemoteServer_ShutdownServer,
eRemoteServer_GetSectionCount,
eRemoteServer_FindSectionByName,
eRemoteServer_FindSectionByType,
eRemoteServer_GetSectionProperties,
@@ -559,6 +560,18 @@ static void ActiveRemoteClientThread(ClientThread *threadData)
SERIALISE_ELEMENT(StackFrames);
}
}
else if(type == eRemoteServer_GetSectionCount)
{
reader.EndChunk();
int count = rdc ? rdc->NumSections() : 0;
{
WRITE_DATA_SCOPE();
SCOPED_SERIALISE_CHUNK(eRemoteServer_GetSectionCount);
SERIALISE_ELEMENT(count);
}
}
else if(type == eRemoteServer_FindSectionByName)
{
std::string name;
@@ -1408,6 +1421,37 @@ public:
rend->Shutdown();
}
int GetSectionCount()
{
if(!Connected())
return 0;
{
WRITE_DATA_SCOPE();
SCOPED_SERIALISE_CHUNK(eRemoteServer_GetSectionCount);
}
int count = 0;
{
READ_DATA_SCOPE();
RemoteServerPacket type = ser.ReadChunk<RemoteServerPacket>();
if(type == eRemoteServer_GetSectionCount)
{
SERIALISE_ELEMENT(count);
}
else
{
RDCERR("Unexpected response to GetSectionCount");
}
ser.EndChunk();
}
return count;
}
int FindSectionByName(const char *name)
{
if(!Connected())