Deleted Added
full compact
ncp_lib.h (52153) ncp_lib.h (52704)
1/*
2 * Copyright (c) 1999, Boris Popov
3 * All rights reserved.
4 *
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

--- 15 unchanged lines hidden (view full) ---

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.
31 *
1/*
2 * Copyright (c) 1999, Boris Popov
3 * All rights reserved.
4 *
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

--- 15 unchanged lines hidden (view full) ---

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.
31 *
32 * $FreeBSD: head/sys/netncp/ncp_lib.h 52153 1999-10-12 11:56:41Z bp $
32 * $FreeBSD: head/sys/netncp/ncp_lib.h 52704 1999-10-31 03:39:03Z bp $
33 */
34
33 */
34
35#ifndef _NCP_LIB_H_
36#define _NCP_LIB_H_
35#ifndef _NETNCP_NCP_LIB_H_
36#define _NETNCP_NCP_LIB_H_
37
38#define IPX
39#define INET
40
41#include <netncp/ncp.h>
42#include <netncp/ncp_conn.h>
43#include <netncp/ncp_user.h>
44#include <netncp/ncp_rq.h>

--- 54 unchanged lines hidden (view full) ---

99 nuint16 hours;
100} NW_TIME;
101
102struct ncp_bitname {
103 u_int bn_bit;
104 char *bn_name;
105};
106
37
38#define IPX
39#define INET
40
41#include <netncp/ncp.h>
42#include <netncp/ncp_conn.h>
43#include <netncp/ncp_user.h>
44#include <netncp/ncp_rq.h>

--- 54 unchanged lines hidden (view full) ---

99 nuint16 hours;
100} NW_TIME;
101
102struct ncp_bitname {
103 u_int bn_bit;
104 char *bn_name;
105};
106
107int ncp_args_parserc(struct ncp_args *na, char *sect, ncp_setopt_t *set_callback);
108int ncp_args_parseopt(struct ncp_args *na, int opt, char *optarg, ncp_setopt_t *set_callback);
107__BEGIN_DECLS
109
108
109int ncp_args_parserc(struct ncp_args *, char *, ncp_setopt_t *);
110int ncp_args_parseopt(struct ncp_args *, int, char *, ncp_setopt_t *);
110
111
112
111struct sockaddr_ipx;
112struct ipx_addr;
113struct sockaddr;
114struct ncp_buf;
115struct rcfile;
116
117int ncp_initlib(void);
113struct sockaddr_ipx;
114struct ipx_addr;
115struct sockaddr;
116struct ncp_buf;
117struct rcfile;
118
119int ncp_initlib(void);
118int ncp_connect(struct ncp_conn_args *li, int *connHandle);
119int ncp_connect_addr(struct sockaddr *sa, NWCONN_HANDLE *chp);
120int ncp_disconnect(int connHandle);
121int ncp_request(int connHandle,int function, struct ncp_buf *ncpbuf);
122int ncp_conn_request(int connHandle, struct ncp_buf *ncpbuf);
123int ncp_login(int connHandle, const char *user, int objtype, const char *password);
124int ncp_conn_scan(struct ncp_conn_loginfo *li, int *connHandle);
120int ncp_connect(struct ncp_conn_args *, int *);
121int ncp_connect_addr(struct sockaddr *, NWCONN_HANDLE *);
122int ncp_disconnect(int);
123int ncp_request(int, int, struct ncp_buf *);
124int ncp_conn_request(int, struct ncp_buf *);
125int ncp_login(int, const char *, int, const char *);
126int ncp_conn_scan(struct ncp_conn_loginfo *, int *);
125int ncp_conn_cnt(void);
126void *ncp_conn_list(void);
127int ncp_conn_cnt(void);
128void *ncp_conn_list(void);
127int ncp_conn_getinfo(int connHandle, struct ncp_conn_stat *ps);
128int ncp_conn_getuser(int connHandle, char **user);
129int ncp_conn2ref(int connHandle, int *connRef);
130int ncp_conn_dup(NWCONN_HANDLE org, NWCONN_HANDLE *res);
131int ncp_path2conn(char *path, int *connHandle);
132int ncp_li_init(struct ncp_conn_loginfo *li, int argc, char *argv[]);
133void ncp_li_done(struct ncp_conn_loginfo *li);
134int ncp_li_login(struct ncp_conn_loginfo *li, int *aconnHandle);
135int ncp_li_readrc(struct ncp_conn_loginfo *li);
136int ncp_li_check(struct ncp_conn_loginfo *li);
137int ncp_li_arg(struct ncp_conn_loginfo *li, int opt, char *arg);
138int ncp_li_setserver(struct ncp_conn_loginfo *li, const char *arg);
139int ncp_li_setuser(struct ncp_conn_loginfo *li, char *arg);
140int ncp_li_setpassword(struct ncp_conn_loginfo *li, const char *passwd);
141int ncp_conn_setflags(int connHandle, u_int16_t mask, u_int16_t flags);
142int ncp_conn_find(char *server, char *user);
143NWCCODE NWRequest(NWCONN_HANDLE cH, nuint16 fn,
144 nuint16 nrq, NW_FRAGMENT* rq,
145 nuint16 nrp, NW_FRAGMENT* rp) ;
129int ncp_conn_getinfo(int, struct ncp_conn_stat *);
130int ncp_conn_getuser(int, char **);
131int ncp_conn2ref(int, int *);
132int ncp_conn_dup(NWCONN_HANDLE, NWCONN_HANDLE *);
133int ncp_path2conn(char *, int *);
134int ncp_li_init(struct ncp_conn_loginfo *, int, char *[]);
135void ncp_li_done(struct ncp_conn_loginfo *);
136int ncp_li_login(struct ncp_conn_loginfo *, int *);
137int ncp_li_readrc(struct ncp_conn_loginfo *);
138int ncp_li_check(struct ncp_conn_loginfo *);
139int ncp_li_arg(struct ncp_conn_loginfo *, int, char *);
140int ncp_li_setserver(struct ncp_conn_loginfo *, const char *);
141int ncp_li_setuser(struct ncp_conn_loginfo *, char *);
142int ncp_li_setpassword(struct ncp_conn_loginfo *, const char *);
143int ncp_conn_setflags(int, u_int16_t, u_int16_t);
144int ncp_conn_find(char *, char *);
145NWCCODE NWRequest(NWCONN_HANDLE, nuint16, nuint16, NW_FRAGMENT *,
146 nuint16, NW_FRAGMENT *);
146
147#define ncp_setpermanent(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PERMANENT, (on) ? NCPFL_PERMANENT : 0)
148#define ncp_setprimary(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PRIMARY, (on) ? NCPFL_PRIMARY : 0)
149
147
148#define ncp_setpermanent(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PERMANENT, (on) ? NCPFL_PERMANENT : 0)
149#define ncp_setprimary(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PRIMARY, (on) ? NCPFL_PRIMARY : 0)
150
150int ncp_find_fileserver(struct ncp_conn_loginfo *li, int af,char *name);
151int ncp_find_server(struct ncp_conn_loginfo *li, int type, int af,char *name);
151int ncp_find_fileserver(struct ncp_conn_loginfo *, int, char *);
152int ncp_find_server(struct ncp_conn_loginfo *, int, int, char *);
152
153/* misc rotines */
153
154/* misc rotines */
154char* ncp_str_upper(char *name);
155char* ncp_str_upper(char *);
155int ncp_open_rcfile(void);
156int ncp_open_rcfile(void);
156int ncp_getopt(int nargc, char * const *nargv, const char *ostr);
157void NWUnpackDateTime(nuint32 dateTime, NW_DATE *sDate, NW_TIME *sTime);
158void NWUnpackDate(nuint16 date, NW_DATE *sDate);
159void NWUnpackTime(nuint16 time, NW_TIME *sTime);
160time_t ncp_UnpackDateTime(nuint32 dateTime);
161int ncp_GetFileServerDateAndTime(NWCONN_HANDLE cH, time_t *target);
162int ncp_SetFileServerDateAndTime(NWCONN_HANDLE cH, time_t * source);
163NWCCODE NWDownFileServer(NWCONN_HANDLE cH, int force);
164NWCCODE NWCloseBindery(NWCONN_HANDLE cH);
165NWCCODE NWOpenBindery(NWCONN_HANDLE cH);
166NWCCODE NWDisableTTS(NWCONN_HANDLE cH);
167NWCCODE NWEnableTTS(NWCONN_HANDLE cH);
168NWCCODE NWDisableFileServerLogin(NWCONN_HANDLE cH);
169NWCCODE NWEnableFileServerLogin(NWCONN_HANDLE cH);
170void ncp_error(char *fmt, int error,...);
171char *ncp_printb(char *dest, int flags, const struct ncp_bitname *bnp);
172void nw_keyhash(const u_char *key, const u_char *buf, int buflen, u_char *target);
173void nw_encrypt(const u_char *fra, const u_char *buf, u_char *target);
174void ipx_print_addr(struct ipx_addr *ipx);
157int ncp_getopt(int, char * const *, const char *);
158void NWUnpackDateTime(nuint32, NW_DATE *, NW_TIME *);
159void NWUnpackDate(nuint16, NW_DATE *);
160void NWUnpackTime(nuint16, NW_TIME *);
161time_t ncp_UnpackDateTime(nuint32);
162int ncp_GetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
163int ncp_SetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
164NWCCODE NWDownFileServer(NWCONN_HANDLE, int);
165NWCCODE NWCloseBindery(NWCONN_HANDLE);
166NWCCODE NWOpenBindery(NWCONN_HANDLE);
167NWCCODE NWDisableTTS(NWCONN_HANDLE);
168NWCCODE NWEnableTTS(NWCONN_HANDLE);
169NWCCODE NWDisableFileServerLogin(NWCONN_HANDLE);
170NWCCODE NWEnableFileServerLogin(NWCONN_HANDLE);
171void ncp_error(char *, int,...);
172char *ncp_printb(char *, int, const struct ncp_bitname *);
173void nw_keyhash(const u_char *, const u_char *, int, u_char *);
174void nw_encrypt(const u_char *, const u_char *, u_char *);
175void ipx_print_addr(struct ipx_addr *);
175
176/* bindery calls */
176
177/* bindery calls */
177int ncp_get_bindery_object_id(int connHandle, u_int16_t object_type, const char *object_name,
178 struct ncp_bindery_object *target);
179int ncp_get_bindery_object_name(int connHandle, u_int32_t object_id,
180 struct ncp_bindery_object *target);
181int ncp_scan_bindery_object(int connHandle, u_int32_t last_id, u_int16_t object_type,
182 char *search_string, struct ncp_bindery_object *target);
183int ncp_read_property_value(int connHandle,int object_type, const char *object_name,
184 int segment, const char *prop_name, struct nw_property *target);
185void shuffle(const u_char *lon, const u_char *buf, int buflen, u_char *target);
186int ncp_get_encryption_key(NWCONN_HANDLE cH, char *target);
187int ncp_change_obj_passwd(NWCONN_HANDLE connid,
188 const struct ncp_bindery_object *object,
189 const u_char *key,
190 const u_char *oldpasswd, const u_char *newpasswd);
191int ncp_keyed_verify_password(NWCONN_HANDLE cH, char *key, char *passwd,
192 struct ncp_bindery_object *objinfo);
178int ncp_get_bindery_object_id(NWCONN_HANDLE, u_int16_t, const char *,
179 struct ncp_bindery_object *);
180int ncp_get_bindery_object_name(NWCONN_HANDLE, u_int32_t,
181 struct ncp_bindery_object *);
182int ncp_scan_bindery_object(NWCONN_HANDLE, u_int32_t, u_int16_t,
183 char *, struct ncp_bindery_object *);
184int ncp_read_property_value(NWCONN_HANDLE, int object_type, const char *,
185 int, const char *, struct nw_property *);
186int ncp_get_encryption_key(NWCONN_HANDLE, char *);
187int ncp_change_obj_passwd(NWCONN_HANDLE,
188 const struct ncp_bindery_object *, const u_char *,
189 const u_char *, const u_char *);
190int ncp_keyed_verify_password(NWCONN_HANDLE, char *, char *,
191 struct ncp_bindery_object *);
193
194/* queue calls */
192
193/* queue calls */
195int ncp_create_queue_job_and_file(int connHandle, u_int32_t queue_id, struct queue_job *job);
196int ncp_close_file_and_start_job(int connHandle, u_int32_t queue_id, struct queue_job *job);
197int ncp_attach_to_queue(int connHandle, u_int32_t queue_id);
198int ncp_detach_from_queue(int connHandle, u_int32_t queue_id);
199int ncp_service_queue_job(int connHandle, u_int32_t queue_id, u_int16_t job_type,
200 struct queue_job *job);
201int ncp_finish_servicing_job(int connHandle, u_int32_t queue_id, u_int32_t job_number,
202 u_int32_t charge_info);
203int ncp_abort_servicing_job(int connHandle, u_int32_t queue_id, u_int32_t job_number);
204int ncp_get_queue_length(int connHandle, u_int32_t queue_id, u_int32_t *queue_length);
205int ncp_get_queue_job_ids(int connHandle, u_int32_t queue_id, u_int32_t queue_section,
206 u_int32_t *length1, u_int32_t *length2, u_int32_t ids[]);
207int ncp_get_queue_job_info(int connHandle, u_int32_t queue_id, u_int32_t job_id,
208 struct nw_queue_job_entry *jobdata);
194int ncp_create_queue_job_and_file(NWCONN_HANDLE, u_int32_t, struct queue_job *);
195int ncp_close_file_and_start_job(NWCONN_HANDLE, u_int32_t, struct queue_job *);
196int ncp_attach_to_queue(NWCONN_HANDLE, u_int32_t);
197int ncp_detach_from_queue(NWCONN_HANDLE, u_int32_t);
198int ncp_service_queue_job(NWCONN_HANDLE, u_int32_t, u_int16_t,
199 struct queue_job *);
200int ncp_finish_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t, u_int32_t);
201int ncp_abort_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t);
202int ncp_get_queue_length(NWCONN_HANDLE, u_int32_t, u_int32_t *);
203int ncp_get_queue_job_ids(NWCONN_HANDLE, u_int32_t, u_int32_t,
204 u_int32_t *, u_int32_t *, u_int32_t []);
205int ncp_get_queue_job_info(NWCONN_HANDLE, u_int32_t, u_int32_t,
206 struct nw_queue_job_entry *);
209/*
210 * file system and volume calls
211 */
207/*
208 * file system and volume calls
209 */
212int ncp_read(int connHandle, ncp_fh *fh, off_t offset, size_t count, char *target);
213int ncp_write(int connHandle, ncp_fh *fh, off_t offset, size_t count, char *source);
214int ncp_geteinfo(char *path, struct nw_entry_info *fi);
215int ncp_NSEntryInfo(NWCONN_HANDLE cH, nuint8 ns, nuint8 vol, nuint32 dirent,
216 NW_ENTRY_INFO *entryInfo);
210int ncp_read(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
211int ncp_write(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
212int ncp_geteinfo(char *, struct nw_entry_info *);
213int ncp_NSEntryInfo(NWCONN_HANDLE, nuint8, nuint8, nuint32, NW_ENTRY_INFO *);
217
214
218NWCCODE NWGetVolumeName(NWCONN_HANDLE cH, u_char volume, char *name);
215NWCCODE NWGetVolumeName(NWCONN_HANDLE, u_char, char *);
219
220/* misc ncp calls */
216
217/* misc ncp calls */
221int ncp_get_file_server_information(int connHandle, struct ncp_file_server_info *target);
222int ncp_get_stations_logged_info(int connHandle, u_int32_t connection,
223 struct ncp_bindery_object *target, time_t *login_time);
224int ncp_get_internet_address(int connHandle, u_int32_t connection, struct ipx_addr *target,
225 u_int8_t * conn_type);
226NWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE connHandle,
227 pnstr8 pObjName, nuint16 objType,
228 pnuint16 pNumConns, pnuint16 pConnHandleList,
229 nuint16 maxConns);
218int ncp_get_file_server_information(NWCONN_HANDLE, struct ncp_file_server_info *);
219int ncp_get_stations_logged_info(NWCONN_HANDLE, u_int32_t,
220 struct ncp_bindery_object *, time_t *);
221int ncp_get_internet_address(NWCONN_HANDLE, u_int32_t, struct ipx_addr *,
222 u_int8_t *);
223NWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE, pnstr8, nuint16,
224 pnuint16, pnuint16, nuint16);
230/*
231 * Message broadcast
232 */
225/*
226 * Message broadcast
227 */
233NWCCODE NWDisableBroadcasts(NWCONN_HANDLE connHandle);
234NWCCODE NWEnableBroadcasts(NWCONN_HANDLE connHandle);
235NWCCODE NWBroadcastToConsole(NWCONN_HANDLE connHandle, pnstr8 message);
236NWCCODE NWSendBroadcastMessage(NWCONN_HANDLE connHandle, pnstr8 message,
237 nuint16 connCount, pnuint16 connList, pnuint8 resultList);
238NWCCODE NWGetBroadcastMessage(NWCONN_HANDLE connHandle, pnstr8 message);
228NWCCODE NWDisableBroadcasts(NWCONN_HANDLE);
229NWCCODE NWEnableBroadcasts(NWCONN_HANDLE);
230NWCCODE NWBroadcastToConsole(NWCONN_HANDLE, pnstr8);
231NWCCODE NWSendBroadcastMessage(NWCONN_HANDLE, pnstr8, nuint16, pnuint16, pnuint8);
232NWCCODE NWGetBroadcastMessage(NWCONN_HANDLE, pnstr8);
239
240/*
241 * RPC calls
242 */
233
234/*
235 * RPC calls
236 */
243NWCCODE NWSMExecuteNCFFile(NWCONN_HANDLE cH, pnstr8 NCFFileName);
244NWCCODE NWSMLoadNLM(NWCONN_HANDLE cH, pnstr8 cmd);
245NWCCODE NWSMUnloadNLM(NWCONN_HANDLE cH, pnstr8 cmd);
246NWCCODE NWSMMountVolume(NWCONN_HANDLE cH, pnstr8 volName, nuint32* volnum);
247NWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE cH, pnstr8 vol);
248NWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE cH, pnstr8 setCommandName, nuint32 cmdValue);
249NWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE cH, pnstr8 setCommandName, pnstr8 cmdValue);
237NWCCODE NWSMExecuteNCFFile(NWCONN_HANDLE, pnstr8);
238NWCCODE NWSMLoadNLM(NWCONN_HANDLE, pnstr8);
239NWCCODE NWSMUnloadNLM(NWCONN_HANDLE, pnstr8);
240NWCCODE NWSMMountVolume(NWCONN_HANDLE, pnstr8, nuint32 *);
241NWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE, pnstr8);
242NWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE, pnstr8, nuint32);
243NWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE, pnstr8, pnstr8);
250
244
251int dostat(int modnum, char *modname, int *offset);
245__END_DECLS
252
246
253extern int ncp_opterr, ncp_optind, ncp_optopt, ncp_optreset;
247extern int ncp_opterr, ncp_optind, ncp_optopt, ncp_optreset;
254extern char *ncp_optarg;
255
256extern struct rcfile *ncp_rc;
257extern int sysentoffset;
248extern char *ncp_optarg;
249
250extern struct rcfile *ncp_rc;
251extern int sysentoffset;
258#endif /* _NCP_LIB_H_ */
252#endif /* _NETNCP_NCP_LIB_H_ */