linprocfs - Introduce /proc/mounts
[dragonfly.git] / sys / netproto / ncp / ncp_lib.h
blob252c65cb4b489ffc81d69fc60771a8225d4ef28a
1 /*
2 * Copyright (c) 1999, 2000, 2001 Boris Popov
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Boris Popov.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
32 * $FreeBSD: src/sys/netncp/ncp_lib.h,v 1.2.2.1 2001/02/22 09:09:51 bp Exp $
33 * $DragonFly: src/sys/netproto/ncp/ncp_lib.h,v 1.3 2003/08/07 21:17:38 dillon Exp $
36 #ifndef _NETNCP_NCP_LIB_H_
37 #define _NETNCP_NCP_LIB_H_
39 #define IPX
40 #define INET
42 #include "ncp.h"
43 #include "ncp_conn.h"
44 #include "ncp_user.h"
45 #include "ncp_rq.h"
47 #define ncp_printf printf
49 #define sipx_cnetwork sipx_addr.x_net.c_net
50 #define sipx_node sipx_addr.x_host.c_host
51 #define ipx_netlong(iaddr) (((union ipx_net_u *)(&((iaddr).x_net)))->long_e)
53 #define STDPARAM_ARGS 'A':case 'B':case 'C':case 'I':case 'M': \
54 case 'N':case 'U':case 'R':case 'S':case 'T': \
55 case 'W':case 'O':case 'P'
57 #define STDPARAM_OPT "A:BCI:M:NO:P:U:R:S:T:W:"
59 #ifndef min
60 #define min(a,b) (((a)<(b)) ? (a) : (b))
61 #endif
65 * An attempt to do a unified options parser
67 enum ncp_argtype {NCA_STR,NCA_INT,NCA_BOOL};
69 struct ncp_args;
71 typedef int ncp_setopt_t (struct ncp_args*);
73 #define NAFL_NONE 0x0000
74 #define NAFL_HAVEMIN 0x0001
75 #define NAFL_HAVEMAX 0x0002
76 #define NAFL_MINMAX NAFL_HAVEMIN | NAFL_HAVEMAX
78 struct ncp_args {
79 enum ncp_argtype at;
80 int opt; /* command line option */
81 char *name; /* rc file equiv */
82 int flag; /* NAFL_* */
83 int ival; /* int/bool values, or max len for str value */
84 char *str; /* string value */
85 int min; /* min for ival */
86 int max; /* max for ival */
87 ncp_setopt_t *fn;/* call back to validate */
90 typedef struct {
91 nuint8 day;
92 nuint8 month;
93 nuint16 year;
94 } NW_DATE;
96 /* hours is a nuint16 so that this structure will be the same length as a dword */
97 typedef struct {
98 nuint8 seconds;
99 nuint8 minutes;
100 nuint16 hours;
101 } NW_TIME;
103 struct ncp_bitname {
104 u_int bn_bit;
105 char *bn_name;
108 __BEGIN_DECLS
110 int ncp_args_parserc(struct ncp_args *, char *, ncp_setopt_t *);
111 int ncp_args_parseopt(struct ncp_args *, int, char *, ncp_setopt_t *);
114 struct sockaddr_ipx;
115 struct ipx_addr;
116 struct sockaddr;
117 struct ncp_buf;
118 struct rcfile;
120 int ncp_initlib(void);
121 int ncp_connect(struct ncp_conn_args *, int *);
122 int ncp_connect_addr(struct sockaddr *, NWCONN_HANDLE *);
123 int ncp_disconnect(int);
124 int ncp_request(int, int, struct ncp_buf *);
125 int ncp_conn_request(int, struct ncp_buf *);
126 int ncp_login(int, const char *, int, const char *);
127 int ncp_conn_scan(struct ncp_conn_loginfo *, int *);
128 int ncp_conn_cnt(void);
129 void *ncp_conn_list(void);
130 int ncp_conn_getinfo(int, struct ncp_conn_stat *);
131 int ncp_conn_getuser(int, char **);
132 int ncp_conn2ref(int, int *);
133 int ncp_conn_dup(NWCONN_HANDLE, NWCONN_HANDLE *);
134 int ncp_path2conn(char *, int *);
135 int ncp_li_init(struct ncp_conn_loginfo *, int, char *[]);
136 void ncp_li_done(struct ncp_conn_loginfo *);
137 int ncp_li_login(struct ncp_conn_loginfo *, int *);
138 int ncp_li_readrc(struct ncp_conn_loginfo *);
139 int ncp_li_check(struct ncp_conn_loginfo *);
140 int ncp_li_arg(struct ncp_conn_loginfo *, int, char *);
141 int ncp_li_setserver(struct ncp_conn_loginfo *, const char *);
142 int ncp_li_setuser(struct ncp_conn_loginfo *, char *);
143 int ncp_li_setpassword(struct ncp_conn_loginfo *, const char *);
144 int ncp_conn_setflags(int, u_int16_t, u_int16_t);
145 int ncp_conn_find(char *, char *);
146 NWCCODE NWRequest(NWCONN_HANDLE, nuint16, nuint16, NW_FRAGMENT *,
147 nuint16, NW_FRAGMENT *);
149 #define ncp_setpermanent(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PERMANENT, (on) ? NCPFL_PERMANENT : 0)
150 #define ncp_setprimary(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PRIMARY, (on) ? NCPFL_PRIMARY : 0)
152 int ncp_find_fileserver(struct ncp_conn_loginfo *, int, char *);
153 int ncp_find_server(struct ncp_conn_loginfo *, int, int, char *);
155 /* misc rotines */
156 char* ncp_str_upper(char *);
157 int ncp_open_rcfile(void);
158 int ncp_getopt(int, char * const *, const char *);
159 void NWUnpackDateTime(nuint32, NW_DATE *, NW_TIME *);
160 void NWUnpackDate(nuint16, NW_DATE *);
161 void NWUnpackTime(nuint16, NW_TIME *);
162 time_t ncp_UnpackDateTime(nuint32);
163 int ncp_GetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
164 int ncp_SetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
165 NWCCODE NWDownFileServer(NWCONN_HANDLE, int);
166 NWCCODE NWCloseBindery(NWCONN_HANDLE);
167 NWCCODE NWOpenBindery(NWCONN_HANDLE);
168 NWCCODE NWDisableTTS(NWCONN_HANDLE);
169 NWCCODE NWEnableTTS(NWCONN_HANDLE);
170 NWCCODE NWDisableFileServerLogin(NWCONN_HANDLE);
171 NWCCODE NWEnableFileServerLogin(NWCONN_HANDLE);
172 void ncp_error(char *, int,...);
173 char *ncp_printb(char *, int, const struct ncp_bitname *);
174 void nw_keyhash(const u_char *, const u_char *, int, u_char *);
175 void nw_encrypt(const u_char *, const u_char *, u_char *);
176 void ipx_print_addr(struct ipx_addr *);
178 /* bindery calls */
179 int ncp_get_bindery_object_id(NWCONN_HANDLE, u_int16_t, const char *,
180 struct ncp_bindery_object *);
181 int ncp_get_bindery_object_name(NWCONN_HANDLE, u_int32_t,
182 struct ncp_bindery_object *);
183 int ncp_scan_bindery_object(NWCONN_HANDLE, u_int32_t, u_int16_t,
184 char *, struct ncp_bindery_object *);
185 int ncp_read_property_value(NWCONN_HANDLE, int object_type, const char *,
186 int, const char *, struct nw_property *);
187 int ncp_get_encryption_key(NWCONN_HANDLE, char *);
188 int ncp_change_obj_passwd(NWCONN_HANDLE,
189 const struct ncp_bindery_object *, const u_char *,
190 const u_char *, const u_char *);
191 int ncp_keyed_verify_password(NWCONN_HANDLE, char *, char *,
192 struct ncp_bindery_object *);
194 /* queue calls */
195 int ncp_create_queue_job_and_file(NWCONN_HANDLE, u_int32_t, struct queue_job *);
196 int ncp_close_file_and_start_job(NWCONN_HANDLE, u_int32_t, struct queue_job *);
197 int ncp_attach_to_queue(NWCONN_HANDLE, u_int32_t);
198 int ncp_detach_from_queue(NWCONN_HANDLE, u_int32_t);
199 int ncp_service_queue_job(NWCONN_HANDLE, u_int32_t, u_int16_t,
200 struct queue_job *);
201 int ncp_finish_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t, u_int32_t);
202 int ncp_abort_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t);
203 int ncp_get_queue_length(NWCONN_HANDLE, u_int32_t, u_int32_t *);
204 int ncp_get_queue_job_ids(NWCONN_HANDLE, u_int32_t, u_int32_t,
205 u_int32_t *, u_int32_t *, u_int32_t []);
206 int ncp_get_queue_job_info(NWCONN_HANDLE, u_int32_t, u_int32_t,
207 struct nw_queue_job_entry *);
209 * file system and volume calls
211 int ncp_read(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
212 int ncp_write(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
213 int ncp_geteinfo(char *, struct nw_entry_info *);
214 int ncp_NSEntryInfo(NWCONN_HANDLE, nuint8, nuint8, nuint32, NW_ENTRY_INFO *);
216 NWCCODE NWGetVolumeName(NWCONN_HANDLE, u_char, char *);
218 /* misc ncp calls */
219 int ncp_get_file_server_information(NWCONN_HANDLE, struct ncp_file_server_info *);
220 int ncp_get_stations_logged_info(NWCONN_HANDLE, u_int32_t,
221 struct ncp_bindery_object *, time_t *);
222 int ncp_get_internet_address(NWCONN_HANDLE, u_int32_t, struct ipx_addr *,
223 u_int8_t *);
224 NWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE, pnstr8, nuint16,
225 pnuint16, pnuint16, nuint16);
227 * Message broadcast
229 NWCCODE NWDisableBroadcasts(NWCONN_HANDLE);
230 NWCCODE NWEnableBroadcasts(NWCONN_HANDLE);
231 NWCCODE NWBroadcastToConsole(NWCONN_HANDLE, pnstr8);
232 NWCCODE NWSendBroadcastMessage(NWCONN_HANDLE, pnstr8, nuint16, pnuint16, pnuint8);
233 NWCCODE NWGetBroadcastMessage(NWCONN_HANDLE, pnstr8);
236 * RPC calls
238 NWCCODE NWSMExecuteNCFFile(NWCONN_HANDLE, pnstr8);
239 NWCCODE NWSMLoadNLM(NWCONN_HANDLE, pnstr8);
240 NWCCODE NWSMUnloadNLM(NWCONN_HANDLE, pnstr8);
241 NWCCODE NWSMMountVolume(NWCONN_HANDLE, pnstr8, nuint32 *);
242 NWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE, pnstr8);
243 NWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE, pnstr8, nuint32);
244 NWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE, pnstr8, pnstr8);
246 __END_DECLS
248 extern int ncp_opterr, ncp_optind, ncp_optopt, ncp_optreset;
249 extern char *ncp_optarg;
251 extern struct rcfile *ncp_rc;
252 extern int sysentoffset;
253 #endif /* _NETNCP_NCP_LIB_H_ */