Commit 6fef2e91 authored by nikolajev's avatar nikolajev
Browse files

SIP codec update to support " " at end of string list

parent a73ffde7
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
//#include "gen_classes.h"
//#include "gen_classes.h"
//#include "Regex.h"
//#include "Regex.h"
#include "common_sip_msrp.h"
#include "common_sip_msrp.h"
#include "common_debug_log.h"
#include <iostream>
#include <iostream>
#include <fstream>
#include <fstream>


@@ -12,7 +13,7 @@ namespace t3devlib { namespace gen {
	logfile << "CaptureSource::PreEncodeField: " << field_id << std::endl;
	logfile << "CaptureSource::PreEncodeField: " << field_id << std::endl;
	logfile.close();
	logfile.close();
}*/
}*/

#define DEBUG_LOG_FILE "C:\\Temp\\LibSip.log"
//
//
// Implementation of the decoder for SDP
// Implementation of the decoder for SDP
//
//
@@ -2515,17 +2516,24 @@ void ServerVal_List::PreEncodeField (int field_id, Buffer& buffer) throw (Encode
void ServerVal_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
void ServerVal_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
{
{
	static Regex reg_content ("^((?:" SIPREG_TOKEN "(?:" SIPREG_SLASH SIPREG_TOKEN ")?)|" SIPREG_COMMENT ")");
	static Regex reg_content ("^((?:" SIPREG_TOKEN "(?:" SIPREG_SLASH SIPREG_TOKEN ")?)|" SIPREG_COMMENT ")");
	debug_log_PreDecodeField(DEBUG_LOG_FILE, "ServerVal_List", id);
	reg_content.AssertMatch(buffer, this);
	reg_content.AssertMatch(buffer, this);
	SetHypFieldLength(reg_content.GetMatchedLength());
	SetHypFieldLength(reg_content.GetMatchedLength());
}
}


void ServerVal_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError)
void ServerVal_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError)
{
{
	static Regex reg_content("^((?:" SIPREG_TOKEN "(?:" SIPREG_SLASH SIPREG_TOKEN ")?)|" SIPREG_COMMENT ")");
	static Regex reg_separator ("^" SIPREG_LWS);
	static Regex reg_separator ("^" SIPREG_LWS);
	if (reg_separator.Match (buffer)) {
	debug_log_PostDecodeField(DEBUG_LOG_FILE, "ServerVal_List", id);

	debug_log(DEBUG_LOG_FILE, GetField(id).GetValue());
	
	if (reg_separator.Match (buffer))
		reg_separator.MovePast (buffer);
		reg_separator.MovePast (buffer);

	if(reg_content.Match(buffer))
		SetHypSize (GetSize() + 1);
		SetHypSize (GetSize() + 1);
	}
	else
	else
		SetHypSize (-2);
		SetHypSize (-2);
}
}
@@ -2914,6 +2922,7 @@ void msgname::PostDecode (Buffer& buffer, DecodeError& e) throw (DecodeError) \
	logfile << "###################################################################################" << std::endl; \
	logfile << "###################################################################################" << std::endl; \
	logfile << "###  INVALID SIP MESSAGE RECEIVED                                               ###" << std::endl; \
	logfile << "###  INVALID SIP MESSAGE RECEIVED                                               ###" << std::endl; \
	logfile << "###################################################################################" << std::endl; \
	logfile << "###################################################################################" << std::endl; \
	logfile << "DecodeError: " << e << std::endl; \
	logfile.write(reinterpret_cast<const char*>(buffer.GetValueBin()), buffer.GetLength()/8); \
	logfile.write(reinterpret_cast<const char*>(buffer.GetValueBin()), buffer.GetLength()/8); \
	logfile.close(); \
	logfile.close(); \
	throw DecodeIgnoreMessage(e.mVar); \
	throw DecodeIgnoreMessage(e.mVar); \