File: btsrv.h

package info (click to toggle)
affix 2.1.1-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,908 kB
  • ctags: 1,247
  • sloc: ansic: 13,807; sh: 7,119; yacc: 232; makefile: 152; lex: 126; python: 56
file content (135 lines) | stat: -rw-r--r-- 3,329 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* 
   Affix - Bluetooth Protocol Stack for Linux
   Copyright (C) 2001,2002 Nokia Corporation
   Author: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>

   Original Author: Imre Deak <ext-imre.deak@nokia.com>

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

/* 
   $Id: btsrv.h,v 1.3 2003/10/06 10:51:24 kds Exp $

   Header file for the BT server user space daemon 

   Fixes:
   		Imre Deak <ext-imre.deak@nokia.com>
   		Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
*/		

#ifndef BTSRV_H
#define BTSRV_H

#if defined(CONFIG_AFFIX_SDP)
#include <affix/sdp.h>
#include <affix/sdpsrv.h>
#endif

#define MAX_PROFILE_NAME_LEN     50
#define MAX_CMD_LEN		256

#define MAX_SERVICE_NUM		32
#define MAX_DEVICE_NUM		8

#define SRV_FLAG_SOCKET		0x01
#define SRV_FLAG_RFCOMM_TTY	0x02
#define SRV_FLAG_STD		0x04

typedef struct _service_t	service_t;

typedef int (*sdpreg_func_t)(service_t *svc);

typedef struct {
	char		*name;//[MAX_PROFILE_NAME_LEN];
	uint16_t	svc_class;
	uint16_t	generic_class;
	uint16_t	profile;
	int		proto;
	sdpreg_func_t	reg_func;
} service_info_t;


/*
 * data structure to keep
 * - configuration info for services
 *
 */
struct _service_t{
	/* service stuff */
	int		running;	/* service state */
	int		active;		/* will be runing */
        int     	port;
	int		srv_fd;
        char    	cmd[MAX_CMD_LEN];
	int		flags;
        char    	*name;		/* service name */
	char		*prov;		/* service provider */
	char		*desc;		/* service description */
	int		security;	/* security level mask */
	uint32_t	cod;		/* additional device class bits */
	service_info_t	*info;
#if defined(CONFIG_AFFIX_SDP)
	sdpsvc_t	*svcRec;
#endif
};

/*
 * data structure to keep 
 * - configuration info for devices
 * - device status
 *
 */
typedef struct _device_t {
	char		name[IFNAMSIZ];
	int		valid;
	char		*btname;	/* device name */
	uint32_t	cod;		/* device class */
	int		scan;
	int		security;	/* security mode */
	int		pkt_type;
	int		role;
} device_t;


extern service_t	services[];
extern service_info_t	profiles[];
extern device_t		devices[];
extern btdev_list	btdevs;
extern char		*config_file;
extern int		initdev;
extern int		startsvc;
extern int		managepin;
extern int		managekey;


int btsrv_read_config(char *config_file, int *service_num, int *device_num);
char *btsrv_format_cmd(const char *cmd, int conid, int line, BD_ADDR *bd_addr, int srv_ch);

int sdpreg_init(void);
void sdpreg_cleanup(void);
int sdpreg_register(service_t *svc);
int sdpreg_unregister(service_t *svc);

#if defined(CONFIG_AFFIX_SDP)
int sdpreg_rfcomm(service_t *svc);
int sdpreg_pan(service_t *svc);
#else
#define sdpreg_rfcomm NULL
#define sdpreg_pan NULL
#endif

#endif	/*	BTSRV_H */