Path: blob/main/usr.sbin/bluetooth/sdpd/irmc_command.c
102404 views
/*-1* irmc_command_command_command.c2*3* SPDX-License-Identifier: BSD-2-Clause4*5* Copyright (c) 2004 Maksim Yevmenkin <[email protected]>6* All rights reserved.7*8* Redistribution and use in source and binary forms, with or without9* modification, are permitted provided that the following conditions10* are met:11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13* 2. Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in the15* documentation and/or other materials provided with the distribution.16*17* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND18* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE21* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL22* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS23* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)24* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT25* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY26* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF27* SUCH DAMAGE.28*29* $Id: irmc_command.c,v 1.5 2004/01/13 01:54:39 max Exp $30*/3132#include <sys/queue.h>33#define L2CAP_SOCKET_CHECKED34#include <bluetooth.h>35#include <sdp.h>36#include <string.h>37#include "profile.h"38#include "provider.h"3940static int32_t41irmc_command_profile_create_service_class_id_list(42uint8_t *buf, uint8_t const * const eob,43uint8_t const *data, uint32_t datalen)44{45static uint16_t service_classes[] = {46SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND47};4849return (common_profile_create_service_class_id_list(50buf, eob,51(uint8_t const *) service_classes,52sizeof(service_classes)));53}5455static int32_t56irmc_command_profile_create_bluetooth_profile_descriptor_list(57uint8_t *buf, uint8_t const * const eob,58uint8_t const *data, uint32_t datalen)59{60static uint16_t profile_descriptor_list[] = {61SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND,620x010063};6465return (common_profile_create_bluetooth_profile_descriptor_list(66buf, eob,67(uint8_t const *) profile_descriptor_list,68sizeof(profile_descriptor_list)));69}7071static int32_t72irmc_command_profile_create_service_name(73uint8_t *buf, uint8_t const * const eob,74uint8_t const *data, uint32_t datalen)75{76static char service_name[] = "Sync Command Service";7778return (common_profile_create_string8(79buf, eob,80(uint8_t const *) service_name, strlen(service_name)));81}8283static int32_t84irmc_command_profile_create_protocol_descriptor_list(85uint8_t *buf, uint8_t const * const eob,86uint8_t const *data, uint32_t datalen)87{88provider_p provider = (provider_p) data;89sdp_irmc_command_profile_p irmc_command = (sdp_irmc_command_profile_p) provider->data;9091return (obex_profile_create_protocol_descriptor_list(92buf, eob,93(uint8_t const *) &irmc_command->server_channel, 1));94}9596static attr_t irmc_command_profile_attrs[] = {97{ SDP_ATTR_SERVICE_RECORD_HANDLE,98common_profile_create_service_record_handle },99{ SDP_ATTR_SERVICE_CLASS_ID_LIST,100irmc_command_profile_create_service_class_id_list },101{ SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST,102irmc_command_profile_create_bluetooth_profile_descriptor_list },103{ SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST,104common_profile_create_language_base_attribute_id_list },105{ SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID + SDP_ATTR_SERVICE_NAME_OFFSET,106irmc_command_profile_create_service_name },107{ SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST,108irmc_command_profile_create_protocol_descriptor_list },109{ 0, NULL } /* end entry */110};111112profile_t irmc_command_profile_descriptor = {113SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND,114sizeof(sdp_irmc_command_profile_t),115common_profile_server_channel_valid,116(attr_t const * const) &irmc_command_profile_attrs117};118119120121