No empty .Rs/.Re
[netbsd-mini2440.git] / sys / dev / pci / n8 / include_private / n8_daemon_common.h
blob6c60c5b079b8236ca4f4892d80febdcb9a078b37
1 /*-
2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
3 * All rights reserved.
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /*****************************************************************************
36 * @(#) n8_daemon_common.h 1.10@(#)
37 *****************************************************************************/
39 /*****************************************************************************/
40 /** @file n8_daemon_common.h
41 * @brief This file defines the message formats used by the
42 * N8 daemon ioctl mechanism, which enables the driver to
43 * depute a specific set of file system procedures to a
44 * dedicated user process or daemon.
46 * This mechanism is split between the kernel driver and
47 * a userspace program. This file should be included by both the driver
48 * and the dedicated user process.
50 *****************************************************************************/
52 /*****************************************************************************
53 * Revision history:
54 * 04/10/02 mmd Created N8_DRIVER_DEVNODE.
55 * 04/04/02 spm Removed definition of daemon lock filename.
56 * 02/05/02 spm Changed n8DaemonStatus_t to N8_Status_t.
57 * 01/22/02 spm Added N8_DAEMON_LOCK_FILE so that it is globally
58 * defined.
59 * 01/19/02 spm Removed nUnits member from message structure,
60 * since now, the API will only ask the N8 daemon
61 * to initialize one (1) execution unit at a time.
62 * 01/16/02 spm Stole N8_KERN_CHECK_RETURN from n8_api_driver.h.
63 * This should be made more publicly available to
64 * the driver code. Removed inline functions.
65 * 12/17/01 spm Original version.
66 ****************************************************************************/
67 #ifndef _N8_DAEMON_COMMON_H
68 #define _N8_DAEMON_COMMON_H
70 /*****************************************************************************
71 * #defines
72 *****************************************************************************/
74 /* devnode for driver */
75 #define N8_DRIVER_DEVNODE "/dev/nsp2000"
77 /* this is the maximum size in bytes of the parm struct. in the case of
78 * the key handles, this is way more memory than necessary.
80 #define N8_DAEMON_MAX_PATH_LEN N8_SKS_ENTRY_NAME_MAX_LENGTH+256 /* max full path length in chars */
82 /* below, len is the desired strlen(str) of str in characters
83 * (i.e. not including the terminating null charcter)
84 * this allows one to force string delimiting after
85 * a specified number of characters, thereby
86 * avoiding nasty seg faults.
88 #define N8_TRUNC_STR(str,len) (((char *) (str))[(len)] = '\0')
90 #define CHECK_RETURN(RET) \
91 if ((RET) != N8_STATUS_OK) \
92 { \
93 break; \
97 /*****************************************************************************
98 * Structures/type definitions
99 *****************************************************************************/
100 /* these enums define the specific set of file system procedures recognized
101 * by the sks daemon ioctl mechanism
103 typedef enum
105 /* bit3 clear means start */
106 N8_DAEMON_WRITE_START = 0x00,
107 N8_DAEMON_RESET_START = 0x01,
108 N8_DAEMON_DELETE_START = 0x02,
109 N8_DAEMON_READ_START = 0x03,
110 N8_DAEMON_INIT_START = 0x04,
111 N8_DAEMON_SHUTDOWN_START = 0x05,
113 /* bit3 set means finish */
114 N8_DAEMON_WRITE_FINISH = 0x08,
115 N8_DAEMON_RESET_FINISH = 0x09,
116 N8_DAEMON_DELETE_FINISH = 0x0A,
117 N8_DAEMON_READ_FINISH = 0x0B,
118 N8_DAEMON_INIT_FINISH = 0x0C,
119 N8_DAEMON_SHUTDOWN_FINISH = 0x0D
121 } n8_DaemonCmd_t;
123 /* If sizeof(PARAMSTRUCT_t) < sizeof(n8DaemonMsg_t)
124 * we can't overlay n8DaemonMsg_t inside
125 * PARMSTRUCT_t (kernel/userspace copying will not work
126 * in N8_ioctl)
128 typedef struct
130 n8_DaemonCmd_t cmd;
131 N8_Status_t status;
132 N8_Unit_t unit;
133 N8_SKSKeyHandle_t *keyHandle_p;
134 N8_Buffer_t *string_p;
135 N8_Buffer_t *SKS_Descriptor_p;
137 } n8_DaemonMsg_t;
141 /*****************************************************************************
142 * Function prototypes
143 *****************************************************************************/
147 #endif /* _N8_DAEMON_COMMON_H */