OBEXGetHeaders(_:_:)
Take a data blob and looks for OBEX headers.
Declaration
func OBEXGetHeaders(_ inData: UnsafeRawPointer!, _ inDataSize: Int) -> CFDictionary!Parameters
- inData:
The data chunk with the headers you are interested in.
- inDataSize:
The size of the buffer you are passing in.
Return Value
A CFDictionary with the headers found in the data blob inside it.
Discussion
You should use this when your callback for PUTs, GETs, etc. give you a data chunk and a size. Pass these params to this function and you will receive a dictionary back full of the parse headers. You can use the CFDictionary calls to get objects out of it, based on the header keys defined above. You are responsible for releasing the CFDictionary returned to you. Example usage:
CFDictionaryRef dictionary = OBEXGetHeaders( data, dataLength );
if( dictionary )
{
if( CFDictionaryGetCountOfKey( dictionary, kOBEXHeaderIDKeyName ) > 0 )
{
CFStringRef theStringRef;
theStringRef = (CFStringRef) CFDictionaryGetValue( dictionary, kOBEXHeaderIDKeyName );
if( theStringRef )
{
// Display it, use it as a filename, whatever.
}
}
if( CFDictionaryGetCountOfKey( dictionary, kOBEXHeaderIDKeyConnectionID ) > 0 )
{
CFDataRef theDataRef;
theDataRef = (CFDataRef) CFDictionaryGetValue( dictionary, kOBEXHeaderIDKeyConnectionID );
if( theDataRef )
{
// now we have data representing the connection ID.
}
}
CFRelease( dictionary );
}
See Also
Miscellaneous
OBEXAddApplicationParameterHeader(_:_:_:)OBEXAddAuthorizationChallengeHeader(_:_:_:)OBEXAddAuthorizationResponseHeader(_:_:_:)OBEXAddBodyHeader(_:_:_:_:)OBEXAddByteSequenceHeader(_:_:_:)OBEXAddConnectionIDHeader(_:_:_:)OBEXAddCountHeader(_:_:)OBEXAddDescriptionHeader(_:_:)OBEXAddHTTPHeader(_:_:_:)OBEXAddLengthHeader(_:_:)OBEXAddNameHeader(_:_:)OBEXAddObjectClassHeader(_:_:_:)OBEXAddTargetHeader(_:_:_:)OBEXAddTime4ByteHeader(_:_:)OBEXAddTimeISOHeader(_:_:_:)