[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]

FreeBSD/Linux Kernel Cross Reference
sys/netncp/ncp_lib.h

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD70  -  FREEBSD6  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

  1 /*-
  2  * Copyright (c) 1999, 2000, 2001 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
  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.
 19  *
 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.
 31  *
 32  * $FreeBSD: src/sys/netncp/ncp_lib.h,v 1.7 2005/01/07 01:45:48 imp Exp $
 33  */
 34 
 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>
 45 
 46 #define ncp_printf printf
 47 
 48 #define sipx_cnetwork   sipx_addr.x_net.c_net
 49 #define sipx_node       sipx_addr.x_host.c_host
 50 #define ipx_netlong(iaddr) (((union ipx_net_u *)(&((iaddr).x_net)))->long_e)
 51 
 52 #define STDPARAM_ARGS   'A':case 'B':case 'C':case 'I':case 'M': \
 53                    case 'N':case 'U':case 'R':case 'S':case 'T': \
 54                    case 'W':case 'O':case 'P'
 55 
 56 #define STDPARAM_OPT    "A:BCI:M:NO:P:U:R:S:T:W:"
 57 
 58 #ifndef min
 59 #define min(a,b)        (((a)<(b)) ? (a) : (b))
 60 #endif
 61 
 62 
 63 /*
 64  * An attempt to do a unified options parser
 65  */
 66 enum ncp_argtype {NCA_STR,NCA_INT,NCA_BOOL};
 67 
 68 struct ncp_args;
 69 
 70 typedef int ncp_setopt_t (struct ncp_args*);
 71 
 72 #define NAFL_NONE       0x0000
 73 #define NAFL_HAVEMIN    0x0001
 74 #define NAFL_HAVEMAX    0x0002
 75 #define NAFL_MINMAX     NAFL_HAVEMIN | NAFL_HAVEMAX
 76 
 77 struct ncp_args {
 78         enum ncp_argtype at;
 79         int     opt;    /* command line option */
 80         char    *name;  /* rc file equiv */
 81         int     flag;   /* NAFL_* */
 82         int     ival;   /* int/bool values, or max len for str value */
 83         char    *str;   /* string value */
 84         int     min;    /* min for ival */
 85         int     max;    /* max for ival */
 86         ncp_setopt_t *fn;/* call back to validate */
 87 };
 88 
 89 typedef struct {
 90   nuint8    day;
 91   nuint8    month;
 92   nuint16   year;
 93 } NW_DATE;
 94 
 95 /* hours is a nuint16  so that this structure will be the same length as a dword */
 96 typedef struct {
 97   nuint8    seconds;
 98   nuint8    minutes;
 99   nuint16   hours;
100 } NW_TIME;
101 
102 struct ncp_bitname {
103         u_int   bn_bit;
104         const char      *bn_name;
105 };
106 
107 __BEGIN_DECLS
108 
109 int ncp_args_parserc(struct ncp_args *, char *, ncp_setopt_t *);
110 int ncp_args_parseopt(struct ncp_args *, int, char *, ncp_setopt_t *);
111 
112 
113 struct sockaddr_ipx;
114 struct ipx_addr;
115 struct sockaddr;
116 struct ncp_buf;
117 struct rcfile;
118 
119 int  ncp_initlib(void);
120 int  ncp_connect(struct ncp_conn_args *, int *);
121 int  ncp_connect_addr(struct sockaddr *, NWCONN_HANDLE *);
122 int  ncp_disconnect(int);
123 int  ncp_request(int, int, struct ncp_buf *);
124 int  ncp_conn_request(int, struct ncp_buf *);
125 int  ncp_login(int, const char *, int, const char *);
126 int  ncp_conn_scan(struct ncp_conn_loginfo *, int *);
127 int  ncp_conn_cnt(void);
128 void *ncp_conn_list(void);
129 int  ncp_conn_getinfo(int, struct ncp_conn_stat *);
130 int  ncp_conn_getuser(int, char **);
131 int  ncp_conn2ref(int, int *);
132 int  ncp_conn_dup(NWCONN_HANDLE, NWCONN_HANDLE *);
133 int  ncp_path2conn(char *, int *);
134 int  ncp_li_init(struct ncp_conn_loginfo *, int, char *[]);
135 void ncp_li_done(struct ncp_conn_loginfo *);
136 int  ncp_li_login(struct ncp_conn_loginfo *, int *);
137 int  ncp_li_readrc(struct ncp_conn_loginfo *);
138 int  ncp_li_check(struct ncp_conn_loginfo *);
139 int  ncp_li_arg(struct ncp_conn_loginfo *, int, char *);
140 int  ncp_li_setserver(struct ncp_conn_loginfo *, const char *);
141 int  ncp_li_setuser(struct ncp_conn_loginfo *, char *);
142 int  ncp_li_setpassword(struct ncp_conn_loginfo *, const char *);
143 int  ncp_conn_setflags(int, u_int16_t, u_int16_t);
144 int  ncp_conn_find(char *, char *);
145 NWCCODE NWRequest(NWCONN_HANDLE, nuint16, nuint16, NW_FRAGMENT *,
146     nuint16, NW_FRAGMENT *);
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 
151 int  ncp_find_fileserver(struct ncp_conn_loginfo *, int, char *);
152 int  ncp_find_server(struct ncp_conn_loginfo *, int, int, char *);
153 
154 /* misc rotines */
155 char* ncp_str_upper(char *);
156 int  ncp_open_rcfile(void);
157 int  ncp_getopt(int, char * const *, const char *);
158 void NWUnpackDateTime(nuint32, NW_DATE *, NW_TIME *);
159 void NWUnpackDate(nuint16, NW_DATE *);
160 void NWUnpackTime(nuint16, NW_TIME *);
161 time_t ncp_UnpackDateTime(nuint32);
162 int  ncp_GetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
163 int  ncp_SetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
164 NWCCODE NWDownFileServer(NWCONN_HANDLE, int);
165 NWCCODE NWCloseBindery(NWCONN_HANDLE);
166 NWCCODE NWOpenBindery(NWCONN_HANDLE);
167 NWCCODE NWDisableTTS(NWCONN_HANDLE);
168 NWCCODE NWEnableTTS(NWCONN_HANDLE);
169 NWCCODE NWDisableFileServerLogin(NWCONN_HANDLE);
170 NWCCODE NWEnableFileServerLogin(NWCONN_HANDLE);
171 void ncp_error(const char *, int, ...) __printf0like(1, 3);
172 char *ncp_printb(char *, int, const struct ncp_bitname *);
173 void nw_keyhash(const u_char *, const u_char *, int, u_char *);
174 void nw_encrypt(const u_char *, const u_char *, u_char *);
175 void ipx_print_addr(struct ipx_addr *);
176 
177 /* bindery calls */
178 int  ncp_get_bindery_object_id(NWCONN_HANDLE, u_int16_t, const char *,
179                 struct ncp_bindery_object *);
180 int  ncp_get_bindery_object_name(NWCONN_HANDLE, u_int32_t,
181                 struct ncp_bindery_object *);
182 int  ncp_scan_bindery_object(NWCONN_HANDLE, u_int32_t, u_int16_t, 
183                 char *, struct ncp_bindery_object *);
184 int  ncp_read_property_value(NWCONN_HANDLE, int object_type, const char *,
185                 int, const char *, struct nw_property *);
186 int  ncp_get_encryption_key(NWCONN_HANDLE, char *);
187 int  ncp_change_obj_passwd(NWCONN_HANDLE, 
188         const struct ncp_bindery_object *, const u_char *,
189         const u_char *, const u_char *);
190 int  ncp_keyed_verify_password(NWCONN_HANDLE, char *, char *,
191                 struct ncp_bindery_object *);
192 
193 /* queue calls */
194 int  ncp_create_queue_job_and_file(NWCONN_HANDLE, u_int32_t, struct queue_job *);
195 int  ncp_close_file_and_start_job(NWCONN_HANDLE, u_int32_t, struct queue_job *);
196 int  ncp_attach_to_queue(NWCONN_HANDLE, u_int32_t);
197 int  ncp_detach_from_queue(NWCONN_HANDLE, u_int32_t);
198 int  ncp_service_queue_job(NWCONN_HANDLE, u_int32_t, u_int16_t,
199                 struct queue_job *);
200 int  ncp_finish_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t, u_int32_t);
201 int  ncp_abort_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t);
202 int  ncp_get_queue_length(NWCONN_HANDLE, u_int32_t, u_int32_t *);
203 int  ncp_get_queue_job_ids(NWCONN_HANDLE, u_int32_t, u_int32_t,
204                 u_int32_t *, u_int32_t *, u_int32_t []);
205 int  ncp_get_queue_job_info(NWCONN_HANDLE, u_int32_t, u_int32_t,
206                 struct nw_queue_job_entry *);
207 /*
208  * filesystem and volume calls 
209  */
210 int  ncp_read(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
211 int  ncp_write(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
212 int  ncp_geteinfo(char *, struct nw_entry_info *);
213 int  ncp_NSEntryInfo(NWCONN_HANDLE, nuint8, nuint8, nuint32, NW_ENTRY_INFO *);
214 
215 NWCCODE NWGetVolumeName(NWCONN_HANDLE, u_char, char *);
216 
217 /* misc ncp calls */
218 int  ncp_get_file_server_information(NWCONN_HANDLE, struct ncp_file_server_info *);
219 int  ncp_get_stations_logged_info(NWCONN_HANDLE, u_int32_t,
220                 struct ncp_bindery_object *, time_t *);
221 int  ncp_get_internet_address(NWCONN_HANDLE, u_int32_t, struct ipx_addr *,
222                 u_int8_t *);
223 NWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE, pnstr8, nuint16,
224                 pnuint16, pnuint16, nuint16);
225 /*
226  * Message broadcast
227  */
228 NWCCODE NWDisableBroadcasts(NWCONN_HANDLE);
229 NWCCODE NWEnableBroadcasts(NWCONN_HANDLE);
230 NWCCODE NWBroadcastToConsole(NWCONN_HANDLE, pnstr8);
231 NWCCODE NWSendBroadcastMessage(NWCONN_HANDLE, pnstr8, nuint16, pnuint16, pnuint8);
232 NWCCODE NWGetBroadcastMessage(NWCONN_HANDLE, pnstr8);
233 
234 /*
235  * RPC calls
236  */
237 NWCCODE NWSMExecuteNCFFile(NWCONN_HANDLE, pnstr8);
238 NWCCODE NWSMLoadNLM(NWCONN_HANDLE, pnstr8);
239 NWCCODE NWSMUnloadNLM(NWCONN_HANDLE, pnstr8);
240 NWCCODE NWSMMountVolume(NWCONN_HANDLE, pnstr8, nuint32 *);
241 NWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE, pnstr8);
242 NWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE, pnstr8, nuint32);
243 NWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE, pnstr8, pnstr8);
244 
245 __END_DECLS
246 
247 extern int ncp_opterr, ncp_optind, ncp_optopt, ncp_optreset;
248 extern char *ncp_optarg;
249 
250 extern struct rcfile *ncp_rc;
251 extern int sysentoffset;
252 #endif /* _NETNCP_NCP_LIB_H_ */
253 

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.