mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-02 07:20:16 +00:00
remove dependency on socket_connection.h in sdp
This commit is contained in:
parent
36944dff77
commit
81aa29cbfd
16
src/sdp.c
16
src/sdp.c
@ -52,7 +52,7 @@ typedef struct {
|
|||||||
linked_item_t item;
|
linked_item_t item;
|
||||||
|
|
||||||
// client connection
|
// client connection
|
||||||
connection_t * connection;
|
void * connection;
|
||||||
|
|
||||||
// data is contained in same memory
|
// data is contained in same memory
|
||||||
uint32_t service_record_handle;
|
uint32_t service_record_handle;
|
||||||
@ -107,11 +107,11 @@ uint32_t sdp_create_service_record_handle(){
|
|||||||
// register service record internally
|
// register service record internally
|
||||||
// pre: AttributeIDs are in ascending order => ServiceRecordHandle is first attribute if present
|
// pre: AttributeIDs are in ascending order => ServiceRecordHandle is first attribute if present
|
||||||
// @returns ServiceRecordHandle or 0 if registration failed
|
// @returns ServiceRecordHandle or 0 if registration failed
|
||||||
uint32_t sdp_register_service_internal(connection_t *connection, uint8_t * record){
|
uint32_t sdp_register_service_internal(void *connection, uint8_t * record){
|
||||||
|
|
||||||
// dump for now
|
// dump for now
|
||||||
// printf("Register service record\n");
|
printf("Register service record\n");
|
||||||
// de_dump_data_element(record);
|
de_dump_data_element(record);
|
||||||
|
|
||||||
// get user record handle
|
// get user record handle
|
||||||
uint32_t record_handle = sdp_get_service_record_handle(record);
|
uint32_t record_handle = sdp_get_service_record_handle(record);
|
||||||
@ -159,8 +159,8 @@ uint32_t sdp_register_service_internal(connection_t *connection, uint8_t * recor
|
|||||||
sdp_append_attributes_in_attributeIDList(record, (uint8_t *) removeServiceRecordHandleAttributeIDList, 0, recordSize, newRecord);
|
sdp_append_attributes_in_attributeIDList(record, (uint8_t *) removeServiceRecordHandleAttributeIDList, 0, recordSize, newRecord);
|
||||||
|
|
||||||
// dump for now
|
// dump for now
|
||||||
// de_dump_data_element(newRecord);
|
de_dump_data_element(newRecord);
|
||||||
// printf("reserved size %u, actual size %u\n", recordSize, de_get_len(newRecord));
|
printf("reserved size %u, actual size %u\n", recordSize, de_get_len(newRecord));
|
||||||
|
|
||||||
// add to linked list
|
// add to linked list
|
||||||
linked_list_add(&sdp_service_records, (linked_item_t *) newRecordItem);
|
linked_list_add(&sdp_service_records, (linked_item_t *) newRecordItem);
|
||||||
@ -171,7 +171,7 @@ uint32_t sdp_register_service_internal(connection_t *connection, uint8_t * recor
|
|||||||
//
|
//
|
||||||
// makes sure one client cannot remove service records of other clients
|
// makes sure one client cannot remove service records of other clients
|
||||||
//
|
//
|
||||||
void sdp_unregister_service_internal(connection_t *connection, uint32_t service_record_handle){
|
void sdp_unregister_service_internal(void *connection, uint32_t service_record_handle){
|
||||||
service_record_item_t * record_item = sdp_get_record_for_handle(service_record_handle);
|
service_record_item_t * record_item = sdp_get_record_for_handle(service_record_handle);
|
||||||
if (record_item && record_item->connection == connection) {
|
if (record_item && record_item->connection == connection) {
|
||||||
linked_list_remove(&sdp_service_records, (linked_item_t *) record_item);
|
linked_list_remove(&sdp_service_records, (linked_item_t *) record_item);
|
||||||
@ -179,7 +179,7 @@ void sdp_unregister_service_internal(connection_t *connection, uint32_t service_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove all service record for a client connection
|
// remove all service record for a client connection
|
||||||
void sdp_unregister_services_for_connection(connection_t *connection){
|
void sdp_unregister_services_for_connection(void *connection){
|
||||||
linked_item_t *it = (linked_item_t *) &sdp_service_records;
|
linked_item_t *it = (linked_item_t *) &sdp_service_records;
|
||||||
while (it->next){
|
while (it->next){
|
||||||
service_record_item_t *record_item = (service_record_item_t *) it->next;
|
service_record_item_t *record_item = (service_record_item_t *) it->next;
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#pragma mark once
|
#pragma mark once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "socket_connection.h"
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDP_ErrorResponse = 1,
|
SDP_ErrorResponse = 1,
|
||||||
@ -47,13 +46,13 @@ void sdp_init();
|
|||||||
|
|
||||||
// register service record internally
|
// register service record internally
|
||||||
// @returns ServiceRecordHandle or 0 if registration failed
|
// @returns ServiceRecordHandle or 0 if registration failed
|
||||||
uint32_t sdp_register_service_internal(connection_t *connection, uint8_t * service_record);
|
uint32_t sdp_register_service_internal(void *connection, uint8_t * service_record);
|
||||||
|
|
||||||
// unregister service record internally
|
// unregister service record internally
|
||||||
void sdp_unregister_service_internal(connection_t *connection, uint32_t service_record_handle);
|
void sdp_unregister_service_internal(void *connection, uint32_t service_record_handle);
|
||||||
|
|
||||||
//
|
//
|
||||||
void sdp_unregister_services_for_connection(connection_t *connection);
|
void sdp_unregister_services_for_connection(void *connection);
|
||||||
|
|
||||||
//
|
//
|
||||||
void sdp_test();
|
void sdp_test();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user