"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/q931.cxx" between
h323plus-1_26_9.tar.gz and h323plus-1_27_0.tar.gz

About: H.323 Plus offers libraries for voice (VoIP) and videoconferencing using H.323.

q931.cxx  (h323plus-1_26_9):q931.cxx  (h323plus-1_27_0)
skipping to change at line 319 skipping to change at line 319
if (data.GetSize() < 5) // Packet too short if (data.GetSize() < 5) // Packet too short
return FALSE; return FALSE;
protocolDiscriminator = data[0]; protocolDiscriminator = data[0];
unsigned callRefLen = data[1]; unsigned callRefLen = data[1];
if (callRefLen > 2) // Call reference is usually 2 bytes long, Innovaphone sen ds 0 length for H.460.17 (supposed to get fixed in r12) if (callRefLen > 2) // Call reference is usually 2 bytes long, Innovaphone sen ds 0 length for H.460.17 (supposed to get fixed in r12)
return FALSE; return FALSE;
if (callRefLen == 2) { if (callRefLen == 2) {
callReference = ((data[2]&0x7f) << 8) | data[3]; callReference = ((data[2] & 0x7f) << 8) | data[3];
fromDestination = (data[2]&0x80) != 0; fromDestination = (data[2] & 0x80) != 0;
} else { } else {
callReference = 0; callReference = 0;
fromDestination = false; fromDestination = false;
} }
messageType = (MsgTypes)data[2+callRefLen]; messageType = (MsgTypes)data[2+callRefLen];
// Have preamble, start getting the informationElements into buffers // Have preamble, start getting the informationElements into buffers
PINDEX offset = 3+callRefLen; PINDEX offset = 3+callRefLen;
while (offset < data.GetSize()) { while (offset < data.GetSize()) {
// Get field discriminator // Get field discriminator
int discriminator = data[offset++]; int discriminator = data[offset++];
PBYTEArray * item = new PBYTEArray; PBYTEArray * item = new PBYTEArray;
// For discriminator with high bit set there is no data // For discriminator with high bit set there is no data
if ((discriminator&0x80) == 0) { if ((discriminator & 0x80) == 0) {
int len = data[offset++]; int len = data[offset++];
if (discriminator == UserUserIE) { if (discriminator == UserUserIE) {
// Special case of User-user field. See 7.2.2.31/H.225.0v4. // Special case of User-user field. See 7.2.2.31/H.225.0v4.
len <<= 8; len <<= 8;
len |= data[offset++]; len |= data[offset++];
// we also have a protocol discriminator, which we ignore // we also have a protocol discriminator, which we ignore
offset++; offset++;
skipping to change at line 585 skipping to change at line 585
informationElements.SetAt(ie, new PBYTEArray(userData)); informationElements.SetAt(ie, new PBYTEArray(userData));
} }
void Q931::RemoveIE(InformationElementCodes ie) void Q931::RemoveIE(InformationElementCodes ie)
{ {
informationElements.RemoveAt(ie); informationElements.RemoveAt(ie);
} }
unsigned Q931::SetBearerTransferRate(unsigned bitrate) unsigned Q931::SetBearerTransferRate(unsigned bitrate)
{ {
unsigned rawTransferRate = bitrate/64000; unsigned rawTransferRate = bitrate / 64000;
if (rawTransferRate <= 2) return rawTransferRate; if (rawTransferRate <= 2) return rawTransferRate;
else if (rawTransferRate <= 6) return 6; else if (rawTransferRate <= 6) return 6;
else if (rawTransferRate <= 24) return 24; else if (rawTransferRate <= 24) return 24;
else if (rawTransferRate >= 30) return 30; else if (rawTransferRate >= 30) return 30;
else return 32; // Never called. Bug with Polycom RMX else return 32; // Never called. Bug with Polycom RMX
} }
void Q931::SetBearerCapabilities(InformationTransferCapability capability, void Q931::SetBearerCapabilities(InformationTransferCapability capability,
unsigned transferRate, unsigned transferRate,
unsigned codingStandard, unsigned codingStandard,
unsigned userInfoLayer1) unsigned userInfoLayer1)
{ {
BYTE data[4]; BYTE data[4];
PINDEX size = 1; PINDEX size = 1;
data[0] = (BYTE)(0x80 | ((codingStandard&3) << 5) | (capability&31)); data[0] = (BYTE)(0x80 | ((codingStandard & 3) << 5) | (capability & 31));
switch (codingStandard) { switch (codingStandard) {
case 0 : // ITU-T standardized coding case 0 : // ITU-T standardized coding
size = 3; size = 3;
// Note this is always "Circuit Mode" // Note this is always "Circuit Mode"
switch (transferRate) { switch (transferRate) {
case 1 : case 1 :
data[1] = 0x90; data[1] = 0x90;
break; break;
skipping to change at line 666 skipping to change at line 666
{ {
if (!HasIE(BearerCapabilityIE)) if (!HasIE(BearerCapabilityIE))
return FALSE; return FALSE;
PBYTEArray data = GetIE(BearerCapabilityIE); PBYTEArray data = GetIE(BearerCapabilityIE);
if (data.GetSize() < 2) if (data.GetSize() < 2)
return FALSE; return FALSE;
capability = (InformationTransferCapability)data[0]; capability = (InformationTransferCapability)data[0];
if (codingStandard != NULL) if (codingStandard != NULL)
*codingStandard = (data[0] >> 5)&3; *codingStandard = (data[0] >> 5) & 3;
PINDEX nextByte = 2; PINDEX nextByte = 2;
switch (data[1]) { switch (data[1]) {
case 0x90 : case 0x90 :
transferRate = 1; transferRate = 1;
break; break;
case 0x91 : case 0x91 :
transferRate = 2; transferRate = 2;
break; break;
case 0x93 : case 0x93 :
skipping to change at line 688 skipping to change at line 688
break; break;
case 0x95 : case 0x95 :
transferRate = 24; transferRate = 24;
break; break;
case 0x97 : case 0x97 :
transferRate = 30; transferRate = 30;
break; break;
case 0x18 : case 0x18 :
if (data.GetSize() < 3) if (data.GetSize() < 3)
return FALSE; return FALSE;
transferRate = data[2]&0x7f; transferRate = data[2] & 0x7f;
nextByte = 3; nextByte = 3;
break; break;
default : default :
return FALSE; return FALSE;
} }
if (userInfoLayer1 != NULL) if (userInfoLayer1 != NULL)
*userInfoLayer1 = data.GetSize() > nextByte && ((data[nextByte]>>5)&3) == 1 ? (data[nextByte]&0x1f) : 0; *userInfoLayer1 = data.GetSize() > nextByte && ((data[nextByte] >> 5) & 3) = = 1 ? (data[nextByte] & 0x1f) : 0;
return TRUE; return TRUE;
} }
void Q931::SetCause(CauseValues value, unsigned standard, unsigned location) void Q931::SetCause(CauseValues value, unsigned standard, unsigned location)
{ {
PBYTEArray data(2); PBYTEArray data(2);
data[0] = (BYTE)(0x80 | ((standard&3) << 5) | (location&15)); data[0] = (BYTE)(0x80 | ((standard & 3) << 5) | (location & 15));
data[1] = (BYTE)(0x80 | value); data[1] = (BYTE)(0x80 | value);
SetIE(CauseIE, data); SetIE(CauseIE, data);
} }
Q931::CauseValues Q931::GetCause(unsigned * standard, unsigned * location) const Q931::CauseValues Q931::GetCause(unsigned * standard, unsigned * location) const
{ {
if (!HasIE(CauseIE)) if (!HasIE(CauseIE))
return ErrorInCauseIE; return ErrorInCauseIE;
PBYTEArray data = GetIE(CauseIE); PBYTEArray data = GetIE(CauseIE);
if (data.GetSize() < 2) if (data.GetSize() < 2)
return ErrorInCauseIE; return ErrorInCauseIE;
if (standard != NULL) if (standard != NULL)
*standard = (data[0] >> 5)&3; *standard = (data[0] >> 5) & 3;
if (location != NULL) if (location != NULL)
*location = data[0]&15; *location = data[0]&15;
if ((data[0]&0x80) != 0) if ((data[0] & 0x80) != 0)
return (CauseValues)(data[1]&0x7f); return (CauseValues)(data[1] & 0x7f);
// Allow for optional octet // Allow for optional octet
if (data.GetSize() < 3) if (data.GetSize() < 3)
return ErrorInCauseIE; return ErrorInCauseIE;
return (CauseValues)(data[2]&0x7f); return (CauseValues)(data[2] & 0x7f);
} }
void Q931::SetCallState(CallStates value, unsigned standard) void Q931::SetCallState(CallStates value, unsigned standard)
{ {
if (value >= CallState_ErrorInIE) if (value >= CallState_ErrorInIE)
return; return;
// Call State as per Q.931 section 4.5.7 // Call State as per Q.931 section 4.5.7
PBYTEArray data(1); PBYTEArray data(1);
data[0] = (BYTE)(((standard&3) << 6) | value); data[0] = (BYTE)(((standard & 3) << 6) | value);
SetIE(CallStateIE, data); SetIE(CallStateIE, data);
} }
Q931::CallStates Q931::GetCallState(unsigned * standard) const Q931::CallStates Q931::GetCallState(unsigned * standard) const
{ {
if (!HasIE(CallStateIE)) if (!HasIE(CallStateIE))
return CallState_ErrorInIE; return CallState_ErrorInIE;
PBYTEArray data = GetIE(CallStateIE); PBYTEArray data = GetIE(CallStateIE);
if (data.IsEmpty()) if (data.IsEmpty())
return CallState_ErrorInIE; return CallState_ErrorInIE;
if (standard != NULL) if (standard != NULL)
*standard = (data[0] >> 6)&3; *standard = (data[0] >> 6) & 3;
return (CallStates)(data[0]&0x3f); return (CallStates)(data[0] & 0x3f);
} }
void Q931::SetSignalInfo(SignalInfo value) void Q931::SetSignalInfo(SignalInfo value)
{ {
PBYTEArray data(1); PBYTEArray data(1);
data[0] = (BYTE)value; data[0] = (BYTE)value;
SetIE(SignalIE, data); SetIE(SignalIE, data);
} }
Q931::SignalInfo Q931::GetSignalInfo() const Q931::SignalInfo Q931::GetSignalInfo() const
skipping to change at line 801 skipping to change at line 801
return PString(); return PString();
return PString((const char *)(const BYTE *)digits, digits.GetSize()); return PString((const char *)(const BYTE *)digits, digits.GetSize());
} }
void Q931::SetProgressIndicator(unsigned description, void Q931::SetProgressIndicator(unsigned description,
unsigned codingStandard, unsigned codingStandard,
unsigned location) unsigned location)
{ {
PBYTEArray data(2); PBYTEArray data(2);
data[0] = (BYTE)(0x80+((codingStandard&0x03)<<5)+(location&0x0f)); data[0] = (BYTE)(0x80+((codingStandard & 0x03) << 5)+(location & 0x0f));
data[1] = (BYTE)(0x80+(description&0x7f)); data[1] = (BYTE)(0x80+(description & 0x7f));
SetIE(ProgressIndicatorIE, data); SetIE(ProgressIndicatorIE, data);
} }
PBoolean Q931::GetProgressIndicator(unsigned & description, PBoolean Q931::GetProgressIndicator(unsigned & description,
unsigned * codingStandard, unsigned * codingStandard,
unsigned * location) const unsigned * location) const
{ {
if (!HasIE(ProgressIndicatorIE)) if (!HasIE(ProgressIndicatorIE))
return FALSE; return FALSE;
 End of changes. 15 change blocks. 
18 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)