OTSDPAttribute::OTSDPAttribute( sdp_data_t * attrib ) { setNil(); switch( attrib->dtd ) { case SDP_DATA_NIL: // Nil type { setNil(); break; } case SDP_UINT8: // Unsigned integer setUInt(attrib->val.uint8); break; case SDP_UINT16: // Unsigned integer setUInt(attrib->val.uint16); break; case SDP_UINT32: // Unsigned integer setUInt(attrib->val.uint32); break; case SDP_UINT64: // Unsigned integer setUInt(attrib->val.uint64); break; case SDP_UINT128: // Unsigned integer // setUInt(attrib->val.uint16); assert(false); // BUG/TODO: uint128 integers not supported break; case SDP_INT8: // Unsigned integer setInt(attrib->val.int8); break; case SDP_INT16: // Unsigned integer setInt(attrib->val.int16); break; case SDP_INT32: // Unsigned integer setInt(attrib->val.int32); break; case SDP_INT64: // Unsigned integer setInt(attrib->val.int64); break; case SDP_INT128: // Unsigned integer // newAttr.setInt(attrib->val.uint16); assert(false); // BUG/TODO: uint128 integers not supported break; case SDP_UUID16: { OTUUID id; ::uuid_t uuidVal = attrib->val.uuid; id.setUUID32(uuidVal.value.uuid16); setUUID(id ); } break; case SDP_UUID32: { OTUUID id; ::uuid_t uuidVal = attrib->val.uuid; id.setUUID32(uuidVal.value.uuid32); setUUID(id ); } break; case SDP_UUID128: { OTUUID id; ::uuid_t uuidVal = attrib->val.uuid; uint64_t* v128; v128 = reinterpret_cast<uint64_t*>(&(uuidVal.value.uuid128)); id.setUUID128(v128[0], v128[1]); setUUID(id ); } break; case SDP_TEXT_STR_UNSPEC : case SDP_TEXT_STR8 : case SDP_TEXT_STR16 : case SDP_TEXT_STR32 : setString( QString(attrib->val.str) ); break; case SDP_URL_STR_UNSPEC : case SDP_URL_STR8 : case SDP_URL_STR16 : case SDP_URL_STR32 : setURL( QString(attrib->val.str) ); break; case SDP_BOOL: setBool( attrib->val.int8 != 0); break; case SDP_SEQ_UNSPEC : case SDP_SEQ8 : case SDP_SEQ16 : case SDP_SEQ32 : case SDP_ALT_UNSPEC : case SDP_ALT8 : case SDP_ALT16 : case SDP_ALT32 : { AttributeVector subAttribs; OTSDPAttribute * Attr; sdp_data_t* subAttrib = attrib->val.dataseq; for (; subAttrib; subAttrib = subAttrib->next) { Attr = new OTSDPAttribute(subAttrib); subAttribs.resize( subAttribs.size() + 1 ); subAttribs.insert( subAttribs.size() - 1, Attr ); } if( attrib->dtd == SDP_ALT_UNSPEC || attrib->dtd == SDP_ALT8 || attrib->dtd == SDP_ALT16 || attrib->dtd == SDP_ALT32 ) { setAlternative(subAttribs); } else { setSequence(subAttribs); } break; } } // end case }