<!--
{
  "documentType" : "article",
  "framework" : "IOBluetooth",
  "identifier" : "/documentation/IOBluetooth/obex-h",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "OBEX.h"
}
-->

# OBEX.h

Public OBEX technology interfaces.

## Discussion

Contains generic OBEX constants, structs, and C API used for all OBEX communication over any transport. For specific transport API, see that transport’s C API. For example, if you wanted to know more about the Bluetooth OBEX implementation, see OBEXBluetooth.h.

The file also contains API that will assist in the construction and deconstruction of OBEX headers to and from raw bytes, as well as the creation of vCards and vEvents.

### Included Headers

- <stdio.h>
- <stdint.h>
- <CoreServices/CoreServices.h>
- <IOBluetooth/IOBluetoothUserLib.h>

## Topics

### Miscellaneous

[`#define GET_HEADER_ID_IS_NULL_TERMINATED_UNICODE_TEXT(HEADER_ID)`](/documentation/IOBluetooth/GET_HEADER_ID_IS_NULL_TERMINATED_UNICODE_TEXT)

Convenience Macros for working with OBEX Header Identifiers.

[`func OBEXAddApplicationParameterHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddApplicationParameterHeader(_:_:_:))

Add bytes representing an application parameter to a dictionary of OBEX headers.

[`func OBEXAddAuthorizationChallengeHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddAuthorizationChallengeHeader(_:_:_:))

Add an authorization challenge header to a dictionary of OBEXheaders.

[`func OBEXAddAuthorizationResponseHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddAuthorizationResponseHeader(_:_:_:))

Add an authorization Response header to a dictionary of OBEXheaders.

[`func OBEXAddBodyHeader(UnsafeRawPointer!, UInt32, Bool, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddBodyHeader(_:_:_:_:))

Add bytes of data to a dictionary of OBEXheaders.

[`func OBEXAddByteSequenceHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddByteSequenceHeader(_:_:_:))

Add a byte sequence header to a dictionary of OBEXheaders.

[`func OBEXAddConnectionIDHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddConnectionIDHeader(_:_:_:))

Add bytes representing a connection ID to a dictionary of OBEX headers.

[`func OBEXAddCountHeader(UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddCountHeader(_:_:))

Add a CFStringRef to a dictionary of OBEXheaders.

[`func OBEXAddDescriptionHeader(CFString!, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddDescriptionHeader(_:_:))

Add a CFStringRef to a dictionary of OBEXheaders.

[`func OBEXAddHTTPHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddHTTPHeader(_:_:_:))

Add bytes of data to a dictionary of OBEXheaders.

[`func OBEXAddLengthHeader(UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddLengthHeader(_:_:))

Add a CFStringRef to a dictionary of OBEXheaders.

[`func OBEXAddNameHeader(CFString!, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddNameHeader(_:_:))

Add a CFStringRef to a dictionary of OBEXheaders.

[`func OBEXAddObjectClassHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddObjectClassHeader(_:_:_:))

Add an object class header to a dictionary of OBEXheaders.

[`func OBEXAddTargetHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddTargetHeader(_:_:_:))

Add bytes of data to a dictionary of OBEXheaders.

[`func OBEXAddTime4ByteHeader(UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddTime4ByteHeader(_:_:))

Add a CFStringRef to a dictionary of OBEXheaders.

[`func OBEXAddTimeISOHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddTimeISOHeader(_:_:_:))

Add bytes to a dictionary of OBEXheaders.

[`func OBEXAddTypeHeader(CFString!, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddTypeHeader(_:_:))

Add a CFStringRef to a dictionary of OBEXheaders.

[`func OBEXAddUserDefinedHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddUserDefinedHeader(_:_:_:))

Add a user-defined custom header to a dictionary of OBEXheaders.

[`func OBEXAddWhoHeader(UnsafeRawPointer!, UInt32, CFMutableDictionary!) -> OBEXError`](/documentation/IOBluetooth/OBEXAddWhoHeader(_:_:_:))

Add bytes of data to a dictionary of OBEXheaders.

[`CFDataRefOBEXCreateVCard(const void *inFirstName, uint32_t inFirstNameLength, const void *inLastName, uint32_t inLastNameLength, const void *inFriendlyName, uint32_t inFriendlyNameLength, const void *inNameCharset, uint32_t inNameCharsetLength, const void *inHomePhone, uint32_t inHomePhoneLength, const void *inWorkPhone, uint32_t inWorkPhoneLength, const void *inCellPhone, uint32_t inCellPhoneLength, const void *inFaxPhone, uint32_t inFaxPhoneLength, const void *inEMailAddress, uint32_t inEMailAddressLength, const void *inEMailAddressCharset, uint32_t inEMailAddressCharsetLength, const void *inOrganization, uint32_t inOrganizationLength, const void *inOrganizationCharset, uint32_t inOrganizationCharsetLength, const void *inTitle, uint32_t inTitleLength, const void *inTitleCharset, uint32_t inTitleCharsetLength);`](/documentation/IOBluetooth/OBEXCreateVCard)

Creates a formatted vCard, ready to be sent over OBEX or whatever.

[`CFDataRefOBEXCreateVEvent(const char *inCharset, uint32_t inCharsetLength, const char *inEncoding, uint32_t inEncodingLength, const char *inEventStartDate, uint32_t inEventStartDateLength, const char *inEventEndDate, uint32_t inEventEndDateLength, const char *inAlarmDate, uint32_t inAlarmDateLength, const char *inCategory, uint32_t inCategoryLength, const char *inSummary, uint32_t inSummaryLength, const char *inLocation, uint32_t inLocationLength, const char *inXIRMCLUID, uint32_t inXIRMCLUIDLength);`](/documentation/IOBluetooth/OBEXCreateVEvent)

Creates a formatted vEvent, ready to be sent over OBEX or whatever. You probably will embed the output in a vCalendar event.

[`func OBEXGetHeaders(UnsafeRawPointer!, Int) -> CFDictionary!`](/documentation/IOBluetooth/OBEXGetHeaders(_:_:))

Take a data blob and looks for OBEX headers.

[`func OBEXHeadersToBytes(CFDictionary!) -> Unmanaged<CFMutableData>!`](/documentation/IOBluetooth/OBEXHeadersToBytes(_:))

Converts a dictionary of headers to a data pointer, from which you can extract as bytes and pass to the OBEX command/response functions.

[`OBEXError OBEXSessionAbort(OBEXSessionRef inSessionRef, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionAbort)

Send an abort command to a remote OBEX server.

[`OBEXError OBEXSessionAbortResponse(OBEXSessionRef inSessionRef, OBEXOpCode inResponseOpCode, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionAbortResponse)

Send a response to a abort command to the remote client.

[`OBEXError OBEXSessionConnect(OBEXSessionRef inSessionRef, OBEXFlags inFlags, OBEXMaxPacketLength inMaxPacketLength, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionConnect)

Establishes an OBEX connection to the target device for the session. If a transport connection is not open yet, it will be opened if possible.

[`OBEXError OBEXSessionConnectResponse(OBEXSessionRef inSessionRef, OBEXOpCode inResponseOpCode, OBEXFlags inFlags, OBEXMaxPacketLength inMaxPacketLength, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionConnectResponse)

Send a response to a connect command to the remote client.

[`OBEXError OBEXSessionDelete(OBEXSessionRef inSessionRef);`](/documentation/IOBluetooth/OBEXSessionDelete)

Destroy an OBEX session. If connections are open, they will (eventually) be terminated for you.

[`OBEXError OBEXSessionDisconnect(OBEXSessionRef inSessionRef, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionDisconnect)

Send a disconnect command to a remote OBEX server.

[`OBEXError OBEXSessionDisconnectResponse(OBEXSessionRef inSessionRef, OBEXOpCode inResponseOpCode, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionDisconnectResponse)

Send a response to a disconnect command to the remote client.

[`OBEXError OBEXSessionGet(OBEXSessionRef inSessionRef, Boolean inIsFinalChunk, void *inHeadersData, size_t inHeadersDataLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionGet)

Send a get command to a remote OBEX server.

[`OBEXError OBEXSessionGetAvailableCommandPayloadLength(OBEXSessionRef inSessionRef, OBEXOpCode inOpCode, OBEXMaxPacketLength *outLength);`](/documentation/IOBluetooth/OBEXSessionGetAvailableCommandPayloadLength)

Gets space available for your data for a particular command response you are trying to send.

[`OBEXError OBEXSessionGetAvailableCommandResponsePayloadLength(OBEXSessionRef inSessionRef, OBEXOpCode inOpCode, OBEXMaxPacketLength *outLength);`](/documentation/IOBluetooth/OBEXSessionGetAvailableCommandResponsePayloadLength)

Gets space available for your data for a particular command response you are trying to send.

[`OBEXError OBEXSessionGetMaxPacketLength(OBEXSessionRef inSessionRef, OBEXMaxPacketLength *outLength);`](/documentation/IOBluetooth/OBEXSessionGetMaxPacketLength)

Gets current max packet length.

[`OBEXError OBEXSessionGetResponse(OBEXSessionRef inSessionRef, OBEXOpCode inResponseOpCode, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionGetResponse)

Send a response to a get command to the remote client.

[`OBEXError OBEXSessionHasOpenOBEXConnection(OBEXSessionRef inSessionRef, Boolean *outIsConnected);`](/documentation/IOBluetooth/OBEXSessionHasOpenOBEXConnection)

Allows you to test the session for an open OBEX connection for a particular session.

[`OBEXError OBEXSessionPut(OBEXSessionRef inSessionRef, Boolean inIsFinalChunk, void *inHeadersData, size_t inHeadersDataLength, void *inBodyData, size_t inBodyDataLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionPut)

Send a put command to a remote OBEX server.

[`OBEXError OBEXSessionPutResponse(OBEXSessionRef inSessionRef, OBEXOpCode inResponseOpCode, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionPutResponse)

Send a response to a put command to the remote client.

[`OBEXError OBEXSessionSetPath(OBEXSessionRef inSessionRef, OBEXFlags inFlags, OBEXConstants inConstants, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionSetPath)

Send a set path command to a remote OBEX server.

[`OBEXError OBEXSessionSetPathResponse(OBEXSessionRef inSessionRef, OBEXOpCode inResponseOpCode, void *inOptionalHeaders, size_t inOptionalHeadersLength, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionSetPathResponse)

Send a response to a set path command to the remote client.

[`OBEXError OBEXSessionSetServerCallback(OBEXSessionRef inSessionRef, OBEXSessionEventCallback inCallback, void *inUserRefCon);`](/documentation/IOBluetooth/OBEXSessionSetServerCallback)

### Data Types

See the Overview for header-level documentation.

[`struct OBEXSessionEvent`](/documentation/IOBluetooth/OBEXSessionEvent)

[`struct OBEXAbortCommandData`](/documentation/IOBluetooth/OBEXAbortCommandData)

Part of the OBEXSessionEvent structure.

[`struct OBEXAbortCommandResponseData`](/documentation/IOBluetooth/OBEXAbortCommandResponseData)

Part of the OBEXSessionEvent structure.

[`struct OBEXConnectCommandData`](/documentation/IOBluetooth/OBEXConnectCommandData)

Part of the OBEXSessionEvent structure.

[`struct OBEXConnectCommandResponseData`](/documentation/IOBluetooth/OBEXConnectCommandResponseData)

Part of the OBEXSessionEvent structure.

[`struct OBEXDisconnectCommandData`](/documentation/IOBluetooth/OBEXDisconnectCommandData)

Part of the OBEXSessionEvent structure.

[`struct OBEXDisconnectCommandResponseData`](/documentation/IOBluetooth/OBEXDisconnectCommandResponseData)

Part of the OBEXSessionEvent structure.

[`struct OBEXErrorData`](/documentation/IOBluetooth/OBEXErrorData)

Part of the OBEXSessionEvent structure.

[`struct OBEXGetCommandData`](/documentation/IOBluetooth/OBEXGetCommandData)

Part of the OBEXSessionEvent structure.

[`struct OBEXGetCommandResponseData`](/documentation/IOBluetooth/OBEXGetCommandResponseData)

Part of the OBEXSessionEvent structure.

[`struct OBEXPutCommandData`](/documentation/IOBluetooth/OBEXPutCommandData)

Part of the OBEXSessionEvent structure.

[`struct OBEXPutCommandResponseData`](/documentation/IOBluetooth/OBEXPutCommandResponseData)

Part of the OBEXSessionEvent structure.

[`struct OBEXSetPathCommandData`](/documentation/IOBluetooth/OBEXSetPathCommandData)

Part of the OBEXSessionEvent structure.

[`struct OBEXSetPathCommandResponseData`](/documentation/IOBluetooth/OBEXSetPathCommandResponseData)

Part of the OBEXSessionEvent structure.

### Constants

See the Overview for header-level documentation.

[`struct OBEXConnectFlagValues`](/documentation/IOBluetooth/OBEXConnectFlagValues)

Flags for Connect command.

[`typealias OBEXError`](/documentation/IOBluetooth/OBEXError)

Codes for OBEX errors. If the return value was not in the following range, then it is most likely resulting from kernel code/IOKit, and you should consult IOReturn.h for those codes.

[`struct OBEXHeaderIdentifiers`](/documentation/IOBluetooth/OBEXHeaderIdentifiers)

Identifiers for OBEX Headers.

[`struct OBEXNonceFlagValues`](/documentation/IOBluetooth/OBEXNonceFlagValues)

Flags for Nonce command during digest challenge.

[`struct OBEXOpCodeCommandValues`](/documentation/IOBluetooth/OBEXOpCodeCommandValues)

Operation OpCode values for commands.

[`struct OBEXOpCodeResponseValues`](/documentation/IOBluetooth/OBEXOpCodeResponseValues)

Response opCode values.

[`struct OBEXOpCodeSessionValues`](/documentation/IOBluetooth/OBEXOpCodeSessionValues)

Operation OpCode values for sessions. From the OBEX 1.3 specification.

[`struct OBEXPutFlagValues`](/documentation/IOBluetooth/OBEXPutFlagValues)

[`struct OBEXRealmValues`](/documentation/IOBluetooth/OBEXRealmValues)

Values for Realm during digest response.

[`struct OBEXSessionEventTypes`](/documentation/IOBluetooth/OBEXSessionEventTypes)

Type identifiers for OBEX sessions.

[`struct OBEXSessionParameterTags`](/documentation/IOBluetooth/OBEXSessionParameterTags)

Tags for SessionParameters.

[`struct OBEXVersions`](/documentation/IOBluetooth/OBEXVersions)

The available/supported OBEX versions.

### Macros

[OBEX Convenience Macros](/documentation/IOBluetooth/obex-convenience-macros)

Convenience Macros for working with OBEX Header Identifiers.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)