Refactored protocol code to use defined IDs rather then raw integers

This commit is contained in:
2015-05-11 09:30:44 +02:00
parent 0bcd3b06f6
commit bb7eb497de
4 changed files with 44 additions and 29 deletions

View File

@ -1086,7 +1086,7 @@ int SCPureSockWrite(SConnection * self, char *buffer, int iOut)
return 0;
}
if(self->iProtocolID == 5) {
if(self->iProtocolID == 4) {
if (strlen(buffer) + 30 > 1024) {
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
memset(pPtr, 0, strlen(buffer) + 20);
@ -1119,7 +1119,7 @@ int SCLogWrite(SConnection * self, char *buffer, int iOut)
WriteToCommandLogId(NULL, self->sockHandle, buffer);
SetSendingConnection(NULL);
if(self->iProtocolID == 5) {
if(self->iProtocolID == 4) {
if (strlen(buffer) + 30 > 1024) {
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
memset(pPtr, 0, strlen(buffer) + 20);
@ -1323,7 +1323,7 @@ int SCWriteZipped(SConnection * self, char *pName, void *pData,
memset(outBuf, 0, 65536);
protocolID = GetProtocolID(self);
if (protocolID == 4) {
if (protocolID == PROTACT) {
cc = SCGetContext(self);
sprintf(outBuf, "SICSBIN ZIP %s %d %d\r\n", pName,
compressedLength, cc.transID);
@ -1398,7 +1398,7 @@ int SCWriteBinary(SConnection * self, char *pName, void *pData,
memset(outBuf, 0, 65536);
protocolID = GetProtocolID(self);
if (protocolID == 4) {
if (protocolID == PROTACT) {
cc = SCGetContext(self);
sprintf(outBuf, "SICSBIN BIN %s %d %d\r\n", pName,
iDataLen, cc.transID);
@ -1504,7 +1504,7 @@ int SCWriteZippedOld(SConnection * self, char *pName, void *pData,
memset(outBuf, 0, 65536);
protocolID = GetProtocolID(self);
if (protocolID == 4) {
if (protocolID == PROTACT) {
cc = SCGetContext(self);
sprintf(outBuf, "SICSBIN ZIP %s %d %d\r\n", pName,
compressedLength, cc.transID);