1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef	_WUSBD_H
27#define	_WUSBD_H
28
29
30#ifdef	__cplusplus
31extern "C" {
32#endif
33
34#define	WUSB_HOST_PATH		"/dev/usb"
35#define	WUSB_HOST_NAME		"whost"
36#define	WUSB_HWA_HOST_NODE	"hwa-host"
37
38#define	DOOR_FILE		"/var/run/wusbd/wusb_door"
39#define	PID_FILE		"/var/run/wusbd/wusb.pid"
40#define	WUSB_CC			"/etc/usb/wusbcc"
41
42/* door server commands */
43enum {
44	WUSB_DCMD_LIST_DATA = 0,
45	WUSB_DCMD_ASSOCIATE,
46	WUSB_DCMD_REMOVE_DEV,
47	WUSB_DCMD_REMOVE_HOST,
48	WUSB_DCMD_ENABLE_HOST,
49	WUSB_DCMD_DISABLE_HOST
50};
51
52enum {
53	WUSBADM_OK = 0,
54	WUSBADM_AUTH_FAILURE, 		/* authorization check failure */
55	WUSBADM_NO_HOST, 		/* host id does not exist */
56	WUSBADM_NO_DEVICE,		/* failure */
57	WUSBADM_CCSTORE_ACC,		/* fail to access CC store */
58	WUSBADM_NO_SUPPORT,		/* failure */
59	WUSBADM_INVAL_HOSTID,		/* host-id not exist */
60	WUSBADM_INVAL_DEVID,		/* dev-id not exist */
61	WUSBADM_HOST_NOT_ATTACH,	/* the device file not exist */
62	WUSBADM_FAILURE			/* other kind of failure */
63};
64
65#define	WUSB_AUTH_READ		"solaris.admin.wusb.read"
66#define	WUSB_AUTH_MODIFY	"solaris.admin.wusb.modify"
67#define	WUSB_AUTH_HOST		"solaris.admin.wusb.host"
68
69#define	WUSB_BUF_LEN		1024
70
71
72/* return values */
73#define	WUSBA_SUCCESS			0
74#define	WUSBA_FAILURE			-1
75
76typedef	struct wusbd_door_call {
77	uint16_t	cmdss;			/* cmd/status */
78	char		buf[WUSB_BUF_LEN];	/* args/return */
79} wusb_door_call_t;
80
81/* association type */
82#define	ASSO_TYPE_NUMERIC	0x01
83#define	ASSO_TYPE_CABLE		0x02
84
85/* assocation data */
86typedef struct wusb_asso_ctrl {
87    uint8_t host;			/* host id */
88    uint8_t type;			/* c/n */
89    uint8_t onetime;			/* onetime/always */
90    char path[MAXPATHLEN];		/* device path */
91} wusb_asso_ctrl_t;
92
93/* host/dev contrl data */
94typedef struct wusb_dev_ctrl {
95    uint8_t host;			/* host id */
96    uint16_t dev;			/* device id */
97} wusb_dev_ctrl_t;
98
99void daemonize();
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif	/* _WUSBD_H */
106