The main data structure is dwc_cc_if_t which is returned by either the dwc_cc_if_alloc function or returned by the module to the user via a provided function. The data structure is opaque and should only be manipulated via the functions provied in this API.
It manages a list of connection contexts and operations can be performed to add, remove, query, search, and change, those contexts. Additionally, a dwc_notifier_t object can be requested from the manager so that the user can be notified whenever the context list has changed.
Connection Context Operations | |
dwc_cc_if_t * | dwc_cc_if_alloc (dwc_notifier_t *notifier, unsigned is_host) |
This function allocates memory for a dwc_cc_if_t structure, initializes fields to default values, and returns a pointer to the structure or NULL on error. | |
void | dwc_cc_if_free (dwc_cc_if_t *cc_if) |
Frees the memory for the specified CC structure allocated from dwc_cc_if_alloc(). | |
void | dwc_cc_clear (dwc_cc_if_t *cc_if) |
Removes all contexts from the connection context list. | |
int32_t | dwc_cc_add (dwc_cc_if_t *cc_if, uint8_t *chid, uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) |
Adds a connection context (CHID, CK, CDID, Name) to the connection context list. | |
void | dwc_cc_change (dwc_cc_if_t *cc_if, int32_t id, uint8_t *chid, uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) |
Changes the CHID, CK, CDID, or Name values of a connection context in the list, preserving any accumulated statistics. | |
void | dwc_cc_remove (dwc_cc_if_t *cc_if, int32_t id) |
Remove the specified connection context. | |
uint8_t * | dwc_cc_data_for_save (dwc_cc_if_t *cc_if, unsigned int *length) |
Get a binary block of data for the connection context list and attributes. | |
void | dwc_cc_restore_from_data (dwc_cc_if_t *cc_if, uint8_t *data, unsigned int length) |
Restore the connection context list from the binary data that was previously returned from a call to dwc_cc_data_for_save. | |
uint32_t | dwc_cc_match_chid (dwc_cc_if_t *cc_if, uint8_t *chid) |
Find the connection context from the specified CHID. | |
uint32_t | dwc_cc_match_cdid (dwc_cc_if_t *cc_if, uint8_t *cdid) |
Find the connection context from the specified CDID. | |
uint8_t * | dwc_cc_ck (dwc_cc_if_t *cc_if, int32_t id) |
Retrieve the CK from the specified connection context. | |
uint8_t * | dwc_cc_chid (dwc_cc_if_t *cc_if, int32_t id) |
Retrieve the CHID from the specified connection context. | |
uint8_t * | dwc_cc_cdid (dwc_cc_if_t *cc_if, int32_t id) |
Retrieve the CDID from the specified connection context. | |
uint8_t * | dwc_cc_name (dwc_cc_if_t *cc_if, int32_t id, uint8_t *length) |
static unsigned | dwc_assoc_is_not_zero_id (uint8_t *id) |
Checks a buffer for non-zero. | |
static unsigned | dwc_assoc_is_zero_id (uint8_t *id) |
Checks a buffer for zero. | |
static int | dwc_print_id_string (char *buffer, uint8_t *id) |
Prints an ASCII representation for the 16-byte chid, cdid, or ck, into buffer. | |
Defines | |
#define | DWC_CC_LIST_CHANGED_NOTIFICATION "DWC_CC_LIST_CHANGED_NOTIFICATION" |
Typedefs | |
typedef dwc_cc_if | dwc_cc_if_t |
dwc_cc_if_t* dwc_cc_if_alloc | ( | dwc_notifier_t * | notifier, | |
unsigned | is_host | |||
) |
This function allocates memory for a dwc_cc_if_t structure, initializes fields to default values, and returns a pointer to the structure or NULL on error.
void dwc_cc_if_free | ( | dwc_cc_if_t * | cc_if | ) |
Frees the memory for the specified CC structure allocated from dwc_cc_if_alloc().
void dwc_cc_clear | ( | dwc_cc_if_t * | cc_if | ) |
Removes all contexts from the connection context list.
int32_t dwc_cc_add | ( | dwc_cc_if_t * | cc_if, | |
uint8_t * | chid, | |||
uint8_t * | cdid, | |||
uint8_t * | ck, | |||
uint8_t * | name, | |||
uint8_t | length | |||
) |
Adds a connection context (CHID, CK, CDID, Name) to the connection context list.
If a CHID already exists, the CK and name are overwritten. Statistics are not overwritten.
cc_if | The cc_if structure. | |
chid | A pointer to the 16-byte CHID. This value will be copied. | |
ck | A pointer to the 16-byte CK. This value will be copied. | |
cdid | A pointer to the 16-byte CDID. This value will be copied. | |
name | An optional host friendly name as defined in the association model spec. Must be a UTF16-LE unicode string. Can be NULL to indicated no name. | |
length | The length othe unicode string. |
void dwc_cc_change | ( | dwc_cc_if_t * | cc_if, | |
int32_t | id, | |||
uint8_t * | chid, | |||
uint8_t * | cdid, | |||
uint8_t * | ck, | |||
uint8_t * | name, | |||
uint8_t | length | |||
) |
Changes the CHID, CK, CDID, or Name values of a connection context in the list, preserving any accumulated statistics.
This would typically be called if the host decideds to change the context with a SET_CONNECTION request.
cc_if | The cc_if structure. | |
id | The identifier of the connection context. | |
chid | A pointer to the 16-byte CHID. This value will be copied. NULL indicates no change. | |
cdid | A pointer to the 16-byte CDID. This value will be copied. NULL indicates no change. | |
ck | A pointer to the 16-byte CK. This value will be copied. NULL indicates no change. | |
name | Host friendly name UTF16-LE. NULL indicates no change. | |
length | Length of name. |
void dwc_cc_remove | ( | dwc_cc_if_t * | cc_if, | |
int32_t | id | |||
) |
Remove the specified connection context.
cc_if | The cc_if structure. | |
id | The identifier of the connection context to remove. |
uint8_t* dwc_cc_data_for_save | ( | dwc_cc_if_t * | cc_if, | |
unsigned int * | length | |||
) |
Get a binary block of data for the connection context list and attributes.
This data can be used by the OS specific driver to save the connection context list into non-volatile memory.
cc_if | The cc_if structure. | |
length | Return the length of the data buffer. |
void dwc_cc_restore_from_data | ( | dwc_cc_if_t * | cc_if, | |
uint8_t * | data, | |||
unsigned int | length | |||
) |
Restore the connection context list from the binary data that was previously returned from a call to dwc_cc_data_for_save.
This can be used by the OS specific driver to load a connection context list from non-volatile memory.
cc_if | The cc_if structure. | |
data | The data bytes as returned from dwc_cc_data_for_save. | |
length | The length of the data. |
uint32_t dwc_cc_match_chid | ( | dwc_cc_if_t * | cc_if, | |
uint8_t * | chid | |||
) |
Find the connection context from the specified CHID.
cc_if | The cc_if structure. | |
chid | A pointer to the CHID data. |
uint32_t dwc_cc_match_cdid | ( | dwc_cc_if_t * | cc_if, | |
uint8_t * | cdid | |||
) |
Find the connection context from the specified CDID.
cc_if | The cc_if structure. | |
cdid | A pointer to the CDID data. |
uint8_t* dwc_cc_ck | ( | dwc_cc_if_t * | cc_if, | |
int32_t | id | |||
) |
Retrieve the CK from the specified connection context.
cc_if | The cc_if structure. | |
id | The identifier of the connection context. |
uint8_t* dwc_cc_chid | ( | dwc_cc_if_t * | cc_if, | |
int32_t | id | |||
) |
Retrieve the CHID from the specified connection context.
cc_if | The cc_if structure. | |
id | The identifier of the connection context. |
uint8_t* dwc_cc_cdid | ( | dwc_cc_if_t * | cc_if, | |
int32_t | id | |||
) |
Retrieve the CDID from the specified connection context.
cc_if | The cc_if structure. | |
id | The identifier of the connection context. |
static unsigned dwc_assoc_is_not_zero_id | ( | uint8_t * | id | ) | [inline, static] |
Checks a buffer for non-zero.
id | A pointer to a 16 byte buffer. |
static unsigned dwc_assoc_is_zero_id | ( | uint8_t * | id | ) | [inline, static] |
Checks a buffer for zero.
id | A pointer to a 16 byte buffer. |
static int dwc_print_id_string | ( | char * | buffer, | |
uint8_t * | id | |||
) | [inline, static] |
Prints an ASCII representation for the 16-byte chid, cdid, or ck, into buffer.