• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2000-2001  Qualcomm Incorporated
6  *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
7  *  Copyright (C) 2002-2008  Marcel Holtmann <marcel@holtmann.org>
8  *
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23  *
24  */
25 
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
29 
30 #include <stdio.h>
31 #include <errno.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include <sys/socket.h>
35 
36 #include <bluetooth/bluetooth.h>
37 #include <bluetooth/hci.h>
38 #include <bluetooth/hci_lib.h>
39 
40 #include "hcid.h"
41 #include "kword.h"
42 #include "parser.h"
43 
44 struct kword cfg_keyword[] = {
45 	{ "options",		K_OPTIONS	},
46 	{ "default",		K_DEVICE	},
47 	{ "device",		K_DEVICE	},
48 	{ "autoinit",		K_AUTOINIT	},
49 	{ "security",		K_SECURITY	},
50 	{ "pairing",		K_PAIRING	},
51 	{ "offmode",		K_OFFMODE	},
52 	{ "deviceid",		K_DEVICEID	},
53 	{ "pkt_type",		K_PTYPE		},
54 	{ "lm", 		K_LM		},
55 	{ "lp", 		K_LP		},
56 	{ "iscan",		K_ISCAN		},
57 	{ "pscan",		K_PSCAN		},
58 	{ "name",		K_NAME		},
59 	{ "class",		K_CLASS		},
60 	{ "voice",		K_VOICE		},
61 	{ "pageto",		K_PAGETO	},
62 	{ "discovto",		K_DISCOVTO	},
63 	{ "passkey",		K_PASSKEY	},
64 
65 	{ "yes",		K_YES		},
66 	{ "no",			K_NO		},
67 	{ "enable",		K_YES		},
68 	{ "disable",		K_NO		},
69 	{ NULL , 0 }
70 };
71 
72 struct kword sec_param[] = {
73 	{ "none",		HCID_SEC_NONE	},
74 	{ "auto",		HCID_SEC_AUTO	},
75 	{ "user",		HCID_SEC_USER	},
76 	{ NULL , 0 }
77 };
78 
79 struct kword pair_param[] = {
80 	{ "none",	HCID_PAIRING_NONE	},
81 	{ "multi",	HCID_PAIRING_MULTI	},
82 	{ "once",	HCID_PAIRING_ONCE	},
83 	{ NULL , 0 }
84 };
85 
86 struct kword off_param[] = {
87 	{ "devdown",	HCID_OFFMODE_DEVDOWN	},
88 	{ "noscan",	HCID_OFFMODE_NOSCAN	},
89 	{ NULL , 0 }
90 };
91 
92 int lineno;
93 
find_keyword(struct kword * kw,char * str)94 int find_keyword(struct kword *kw, char *str)
95 {
96 	while (kw->str) {
97 		if (!strcmp(str,kw->str))
98 			return kw->type;
99 		kw++;
100 	}
101 	return -1;
102 }
103