summaryrefslogtreecommitdiff
path: root/NetWare/nwperlsys.h
blob: b8c9790701d60a705a33a11bef9e400c99b302fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
/*
 * Copyright © 2001 Novell, Inc. All Rights Reserved.
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Artistic License, as specified in the README file.
 *
 */

/*
 * FILENAME		:	nwperlsys.h
 * DESCRIPTION	:	Derives from iperlsys.h and define the platform specific function
 * Author		:	SGP
 * Date	Created	:	June 12th 2001.
 * Date Modified:
 */

#ifndef ___NWPerlSys_H___
#define ___NWPerlSys_H___


#include "iperlsys.h"

//Socket related calls
#include "nw5sck.h"

//Store the Watcom hash list
#include "nwtinfo.h"

//Watcom hash list
#include <wchash.h>

/* IPerlMem - Memory management - Begin ==================================================*/

void* PerlMemMalloc(struct IPerlMem* piPerl, size_t size);
void* PerlMemRealloc(struct IPerlMem* piPerl, void* ptr, size_t size);
void  PerlMemFree(struct IPerlMem* piPerl, void* ptr);
void* PerlMemCalloc(struct IPerlMem* piPerl, size_t num, size_t size);

struct IPerlMem perlMem =
{
    PerlMemMalloc,
    PerlMemRealloc,
    PerlMemFree,
    PerlMemCalloc,
};

/* IPerlMem - Memory management - End   ==================================================*/

/* IPerlDir	- Directory Manipulation - Begin =============================================*/

int PerlDirMakedir(struct IPerlDir* piPerl, const char *dirname, int mode);
int PerlDirChdir(struct IPerlDir* piPerl, const char *dirname);
int PerlDirRmdir(struct IPerlDir* piPerl, const char *dirname);
int PerlDirClose(struct IPerlDir* piPerl, DIR *dirp);
DIR* PerlDirOpen(struct IPerlDir* piPerl, char *filename);
struct direct * PerlDirRead(struct IPerlDir* piPerl, DIR *dirp);
void PerlDirRewind(struct IPerlDir* piPerl, DIR *dirp);
void PerlDirSeek(struct IPerlDir* piPerl, DIR *dirp, long loc);
long PerlDirTell(struct IPerlDir* piPerl, DIR *dirp);

struct IPerlDir perlDir =
{
	PerlDirMakedir,
    PerlDirChdir,
    PerlDirRmdir,
    PerlDirClose,
    PerlDirOpen,
    PerlDirRead,
    PerlDirRewind,
    PerlDirSeek,
    PerlDirTell,
};

/* IPerlDir	- Directory Manipulation - End   =============================================*/

/* IPerlEnv	- Environment related functions - Begin ======================================*/

char* PerlEnvGetenv(struct IPerlEnv* piPerl, const char *varname);
int PerlEnvPutenv(struct IPerlEnv* piPerl, const char *envstring);
char* PerlEnvGetenv_len(struct IPerlEnv* piPerl, const char* varname, unsigned long* len);
int PerlEnvUname(struct IPerlEnv* piPerl, struct utsname *name);
void PerlEnvClearenv(struct IPerlEnv* piPerl);

//Uncomment the following prototypes and the function names in the structure below
//whenever it is implemented.
//The function definition to be put in nwperlsys.c

/*void* PerlEnvGetChildenv(struct IPerlEnv* piPerl);
void PerlEnvFreeChildenv(struct IPerlEnv* piPerl, void* childEnv);
char* PerlEnvGetChilddir(struct IPerlEnv* piPerl);
void PerlEnvFreeChilddir(struct IPerlEnv* piPerl, char* childDir);*/

struct IPerlEnv perlEnv = 
{
	PerlEnvGetenv,
	PerlEnvPutenv,
    PerlEnvGetenv_len,
    PerlEnvUname,
    PerlEnvClearenv,
/*    PerlEnvGetChildenv,
    PerlEnvFreeChildenv,
    PerlEnvGetChilddir,
    PerlEnvFreeChilddir,*/
};

/* IPerlEnv	- Environment related functions - Begin ======================================*/

/* IPerlStdio	- Stdio functions - Begin ================================================*/

FILE* PerlStdIOStdin(struct IPerlStdIO* piPerl);
FILE* PerlStdIOStdout(struct IPerlStdIO* piPerl);
FILE* PerlStdIOStderr(struct IPerlStdIO* piPerl);
FILE* PerlStdIOOpen(struct IPerlStdIO* piPerl, const char *path, const char *mode);
int PerlStdIOClose(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOEof(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOError(struct IPerlStdIO* piPerl, FILE* pf);
void PerlStdIOClearerr(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOGetc(struct IPerlStdIO* piPerl, FILE* pf);
char* PerlStdIOGetBase(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOGetBufsiz(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOGetCnt(struct IPerlStdIO* piPerl, FILE* pf);
char* PerlStdIOGetPtr(struct IPerlStdIO* piPerl, FILE* pf);
char* PerlStdIOGets(struct IPerlStdIO* piPerl, FILE* pf, char* s, int n);
int PerlStdIOPutc(struct IPerlStdIO* piPerl, FILE* pf, int c);
int PerlStdIOPuts(struct IPerlStdIO* piPerl, FILE* pf, const char *s);
int PerlStdIOFlush(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOUngetc(struct IPerlStdIO* piPerl, int c, FILE* pf);
int PerlStdIOFileno(struct IPerlStdIO* piPerl, FILE* pf);
FILE* PerlStdIOFdopen(struct IPerlStdIO* piPerl, int fd, const char *mode);
FILE* PerlStdIOReopen(struct IPerlStdIO* piPerl, const char*path, const char*mode, FILE* pf);
SSize_t PerlStdIORead(struct IPerlStdIO* piPerl, void *buffer, Size_t size, Size_t count, FILE* pf);
SSize_t PerlStdIOWrite(struct IPerlStdIO* piPerl, const void *buffer, Size_t size, Size_t count, FILE* pf);
void PerlStdIOSetBuf(struct IPerlStdIO* piPerl, FILE* pf, char* buffer);
int PerlStdIOSetVBuf(struct IPerlStdIO* piPerl, FILE* pf, char* buffer, int type, Size_t size);
void PerlStdIOSetCnt(struct IPerlStdIO* piPerl, FILE* pf, int n);
void PerlStdIOSetPtr(struct IPerlStdIO* piPerl, FILE* pf, char * ptr);
void PerlStdIOSetlinebuf(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOPrintf(struct IPerlStdIO* piPerl, FILE* pf, const char *format,...);
int PerlStdIOVprintf(struct IPerlStdIO* piPerl, FILE* pf, const char *format, va_list arglist);
long PerlStdIOTell(struct IPerlStdIO* piPerl, FILE* pf);
int PerlStdIOSeek(struct IPerlStdIO* piPerl, FILE* pf, off_t offset, int origin);
void PerlStdIORewind(struct IPerlStdIO* piPerl, FILE* pf);
FILE* PerlStdIOTmpfile(struct IPerlStdIO* piPerl);
int PerlStdIOGetpos(struct IPerlStdIO* piPerl, FILE* pf, Fpos_t *p);
int PerlStdIOSetpos(struct IPerlStdIO* piPerl, FILE* pf, const Fpos_t *p);
void PerlStdIOInit(struct IPerlStdIO* piPerl);
void PerlStdIOInitOSExtras(struct IPerlStdIO* piPerl);
int PerlStdIOOpenOSfhandle(struct IPerlStdIO* piPerl, long osfhandle, int flags);
int PerlStdIOGetOSfhandle(struct IPerlStdIO* piPerl, int filenum);
FILE* PerlStdIOFdupopen(struct IPerlStdIO* piPerl, FILE* pf);

struct IPerlStdIO perlStdIO =
{
	PerlStdIOStdin,
    PerlStdIOStdout,
    PerlStdIOStderr,
    PerlStdIOOpen,
    PerlStdIOClose,
    PerlStdIOEof,
    PerlStdIOError,
    PerlStdIOClearerr,
    PerlStdIOGetc,
    PerlStdIOGetBase,
    PerlStdIOGetBufsiz,
    PerlStdIOGetCnt,
    PerlStdIOGetPtr,
    PerlStdIOGets,
    PerlStdIOPutc,
    PerlStdIOPuts,
    PerlStdIOFlush,
    PerlStdIOUngetc,
    PerlStdIOFileno,
    PerlStdIOFdopen,
    PerlStdIOReopen,
    PerlStdIORead,
    PerlStdIOWrite,
    PerlStdIOSetBuf,
    PerlStdIOSetVBuf,
    PerlStdIOSetCnt,
    PerlStdIOSetPtr,
    PerlStdIOSetlinebuf,
    PerlStdIOPrintf,
    PerlStdIOVprintf,
    PerlStdIOTell,
    PerlStdIOSeek,
    PerlStdIORewind,
    PerlStdIOTmpfile,
    PerlStdIOGetpos,
    PerlStdIOSetpos,
    PerlStdIOInit,
    PerlStdIOInitOSExtras,
    PerlStdIOFdupopen,
};

/* IPerlStdio	- Stdio functions - End   ================================================*/

/* IPerlLIO	- Low-level IO functions - Begin =============================================*/

int PerlLIOAccess(struct IPerlLIO* piPerl, const char *path, int mode);
int PerlLIOChmod(struct IPerlLIO* piPerl, const char *filename, int pmode);
int PerlLIOChown(struct IPerlLIO* piPerl, const char *filename, uid_t owner, gid_t group);
int PerlLIOChsize(struct IPerlLIO* piPerl, int handle, long size);
int PerlLIOClose(struct IPerlLIO* piPerl, int handle);
int PerlLIODup(struct IPerlLIO* piPerl, int handle);
int PerlLIODup2(struct IPerlLIO* piPerl, int handle1, int handle2);
int PerlLIOFlock(struct IPerlLIO* piPerl, int fd, int oper);
int PerlLIOFileStat(struct IPerlLIO* piPerl, int handle, struct stat *buffer);
int PerlLIOIOCtl(struct IPerlLIO* piPerl, int i, unsigned int u, char *data);
int PerlLIOIsatty(struct IPerlLIO* piPerl, int fd);
int PerlLIOLink(struct IPerlLIO* piPerl, const char*oldname, const char *newname);
long PerlLIOLseek(struct IPerlLIO* piPerl, int handle, long offset, int origin);
int PerlLIOLstat(struct IPerlLIO* piPerl, const char *path, struct stat *buffer);
char* PerlLIOMktemp(struct IPerlLIO* piPerl, char *Template);
int PerlLIOOpen(struct IPerlLIO* piPerl, const char *filename, int oflag);
int PerlLIOOpen3(struct IPerlLIO* piPerl, const char *filename, int oflag, int pmode);
int PerlLIORead(struct IPerlLIO* piPerl, int handle, void *buffer, unsigned int count);
int PerlLIORename(struct IPerlLIO* piPerl, const char *OldFileName, const char *newname);
int PerlLIOSetmode(struct IPerlLIO* piPerl, FILE *fp, int mode);
int PerlLIONameStat(struct IPerlLIO* piPerl, const char *path, struct stat *buffer);
char* PerlLIOTmpnam(struct IPerlLIO* piPerl, char *string);
int PerlLIOUmask(struct IPerlLIO* piPerl, int pmode);
int PerlLIOUnlink(struct IPerlLIO* piPerl, const char *filename);
int PerlLIOUtime(struct IPerlLIO* piPerl, char *filename, struct utimbuf *times);
int PerlLIOWrite(struct IPerlLIO* piPerl, int handle, const void *buffer, unsigned int count);

struct IPerlLIO perlLIO =
{
	PerlLIOAccess,
    PerlLIOChmod,
    PerlLIOChown,
    PerlLIOChsize,
    PerlLIOClose,
    PerlLIODup,
    PerlLIODup2,
    PerlLIOFlock,
    PerlLIOFileStat,
    PerlLIOIOCtl,
    PerlLIOIsatty,
    PerlLIOLink,
    PerlLIOLseek,
    PerlLIOLstat,
    PerlLIOMktemp,
    PerlLIOOpen,
    PerlLIOOpen3,
    PerlLIORead,
    PerlLIORename,
    PerlLIOSetmode,
    PerlLIONameStat,
    PerlLIOTmpnam,
    PerlLIOUmask,
    PerlLIOUnlink,
    PerlLIOUtime,
    PerlLIOWrite,    
};

/* IPerlLIO	- Low-level IO functions - End ==============================================*/

/* IPerlProc - Process control functions - Begin =========================================*/

void PerlProcAbort(struct IPerlProc* piPerl);
char * PerlProcCrypt(struct IPerlProc* piPerl, const char* clear, const char* salt);
void PerlProcExit(struct IPerlProc* piPerl, int status);
void PerlProc_Exit(struct IPerlProc* piPerl, int status);
int PerlProcExecl(struct IPerlProc* piPerl, const char *cmdname, const char *arg0, const char *arg1, const char *arg2, const char *arg3);
int PerlProcExecv(struct IPerlProc* piPerl, const char *cmdname, const char *const *argv);
int PerlProcExecvp(struct IPerlProc* piPerl, const char *cmdname, const char *const *argv);
uid_t PerlProcGetuid(struct IPerlProc* piPerl);
uid_t PerlProcGeteuid(struct IPerlProc* piPerl);
gid_t PerlProcGetgid(struct IPerlProc* piPerl);
gid_t PerlProcGetegid(struct IPerlProc* piPerl);
char * PerlProcGetlogin(struct IPerlProc* piPerl);
int PerlProcKill(struct IPerlProc* piPerl, int pid, int sig);
int PerlProcKillpg(struct IPerlProc* piPerl, int pid, int sig);
int PerlProcPauseProc(struct IPerlProc* piPerl);
PerlIO* PerlProcPopen(struct IPerlProc* piPerl, const char *command, const char *mode);
int PerlProcPclose(struct IPerlProc* piPerl, PerlIO *stream);
int PerlProcPipe(struct IPerlProc* piPerl, int *phandles);
int PerlProcSetuid(struct IPerlProc* piPerl, uid_t u);
int PerlProcSetgid(struct IPerlProc* piPerl, gid_t g);
int PerlProcSleep(struct IPerlProc* piPerl, unsigned int s);
int PerlProcTimes(struct IPerlProc* piPerl, struct tms *timebuf);
int PerlProcWait(struct IPerlProc* piPerl, int *status);
int PerlProcWaitpid(struct IPerlProc* piPerl, int pid, int *status, int flags);
Sighandler_t PerlProcSignal(struct IPerlProc* piPerl, int sig, Sighandler_t subcode);
int PerlProcFork(struct IPerlProc* piPerl);
int PerlProcGetpid(struct IPerlProc* piPerl);
int PerlProcSpawn(struct IPerlProc* piPerl, char* cmds);
int PerlProcSpawnvp(struct IPerlProc* piPerl, int mode, const char *cmdname, const char *const *argv);
int PerlProcASpawn(struct IPerlProc* piPerl, void *vreally, void **vmark, void **vsp);

struct IPerlProc perlProc =
{
    PerlProcAbort,
    PerlProcCrypt,
    PerlProcExit,
    PerlProc_Exit,
    PerlProcExecl,
    PerlProcExecv,
    PerlProcExecvp,
    PerlProcGetuid,
    PerlProcGeteuid,
    PerlProcGetgid,
    PerlProcGetegid,
    PerlProcGetlogin,
    PerlProcKill,
    PerlProcKillpg,
    PerlProcPauseProc,
    PerlProcPopen,
    PerlProcPclose,
    PerlProcPipe,
    PerlProcSetuid,
    PerlProcSetgid,
    PerlProcSleep,
    PerlProcTimes,
    PerlProcWait,
    PerlProcWaitpid,
    PerlProcSignal,
    PerlProcFork,
    PerlProcGetpid,
    //PerlProcLastHost;
    //PerlProcPopenList;
};

/* IPerlProc - Process control functions - End   =========================================*/

/* IPerlSock - Socket functions - Begin ==================================================*/

u_long PerlSockHtonl(struct IPerlSock* piPerl, u_long hostlong);
u_short PerlSockHtons(struct IPerlSock* piPerl, u_short hostshort);
u_long PerlSockNtohl(struct IPerlSock* piPerl, u_long netlong);
u_short PerlSockNtohs(struct IPerlSock* piPerl, u_short netshort);
SOCKET PerlSockAccept(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* addr, int* addrlen);
int PerlSockBind(struct IPerlSock* piPerl, SOCKET s, const struct sockaddr* name, int namelen);
int PerlSockConnect(struct IPerlSock* piPerl, SOCKET s, const struct sockaddr* name, int namelen);
void PerlSockEndhostent(struct IPerlSock* piPerl);
void PerlSockEndnetent(struct IPerlSock* piPerl);
void PerlSockEndprotoent(struct IPerlSock* piPerl);
void PerlSockEndservent(struct IPerlSock* piPerl);
struct hostent* PerlSockGethostbyaddr(struct IPerlSock* piPerl, const char* addr, int len, int type);
struct hostent* PerlSockGethostbyname(struct IPerlSock* piPerl, const char* name);
struct hostent* PerlSockGethostent(struct IPerlSock* piPerl);
int PerlSockGethostname(struct IPerlSock* piPerl, char* name, int namelen);
struct netent * PerlSockGetnetbyaddr(struct IPerlSock* piPerl, long net, int type);
struct netent * PerlSockGetnetbyname(struct IPerlSock* piPerl, const char *name);
struct netent * PerlSockGetnetent(struct IPerlSock* piPerl);
int PerlSockGetpeername(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* name, int* namelen);
struct protoent* PerlSockGetprotobyname(struct IPerlSock* piPerl, const char* name);
struct protoent* PerlSockGetprotobynumber(struct IPerlSock* piPerl, int number);
struct protoent* PerlSockGetprotoent(struct IPerlSock* piPerl);
struct servent* PerlSockGetservbyname(struct IPerlSock* piPerl, const char* name, const char* proto);
struct servent* PerlSockGetservbyport(struct IPerlSock* piPerl, int port, const char* proto);
struct servent* PerlSockGetservent(struct IPerlSock* piPerl);
int PerlSockGetsockname(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* name, int* namelen);
int PerlSockGetsockopt(struct IPerlSock* piPerl, SOCKET s, int level, int optname, char* optval, int* optlen);
unsigned long PerlSockInetAddr(struct IPerlSock* piPerl, const char* cp);
char* PerlSockInetNtoa(struct IPerlSock* piPerl, struct in_addr in);
int PerlSockListen(struct IPerlSock* piPerl, SOCKET s, int backlog);
int PerlSockRecv(struct IPerlSock* piPerl, SOCKET s, char* buffer, int len, int flags);
int PerlSockRecvfrom(struct IPerlSock* piPerl, SOCKET s, char* buffer, int len, int flags, struct sockaddr* from, int* fromlen);
int PerlSockSelect(struct IPerlSock* piPerl, int nfds, char* readfds, char* writefds, char* exceptfds, const struct timeval* timeout);
int PerlSockSend(struct IPerlSock* piPerl, SOCKET s, const char* buffer, int len, int flags);
int PerlSockSendto(struct IPerlSock* piPerl, SOCKET s, const char* buffer, int len, int flags, const struct sockaddr* to, int tolen);
void PerlSockSethostent(struct IPerlSock* piPerl, int stayopen);
void PerlSockSetnetent(struct IPerlSock* piPerl, int stayopen);
void PerlSockSetprotoent(struct IPerlSock* piPerl, int stayopen);
void PerlSockSetservent(struct IPerlSock* piPerl, int stayopen);
int PerlSockSetsockopt(struct IPerlSock* piPerl, SOCKET s, int level, int optname, const char* optval, int optlen);
int PerlSockShutdown(struct IPerlSock* piPerl, SOCKET s, int how);
SOCKET PerlSockSocket(struct IPerlSock* piPerl, int af, int type, int protocol);
int PerlSockSocketpair(struct IPerlSock* piPerl, int domain, int type, int protocol, int* fds);
int PerlSockIoctlsocket(struct IPerlSock* piPerl, SOCKET s, long cmd, u_long *argp);

struct IPerlSock  perlSock =
{
	PerlSockHtonl,
    PerlSockHtons,
    PerlSockNtohl,
    PerlSockNtohs,
    PerlSockAccept,
    PerlSockBind,
    PerlSockConnect,
    PerlSockEndhostent,
    PerlSockEndnetent,
    PerlSockEndprotoent,
    PerlSockEndservent,
    PerlSockGethostname,
    PerlSockGetpeername,
    PerlSockGethostbyaddr,
    PerlSockGethostbyname,
    PerlSockGethostent,
    PerlSockGetnetbyaddr,
    PerlSockGetnetbyname,
    PerlSockGetnetent,
    PerlSockGetprotobyname,
    PerlSockGetprotobynumber,
    PerlSockGetprotoent,
    PerlSockGetservbyname,
    PerlSockGetservbyport,
    PerlSockGetservent,
    PerlSockGetsockname,
    PerlSockGetsockopt,
    PerlSockInetAddr,
	PerlSockInetNtoa,
	PerlSockListen,
    PerlSockRecv,
    PerlSockRecvfrom,
    PerlSockSelect,
    PerlSockSend,
    PerlSockSendto,
    PerlSockSethostent,
    PerlSockSetnetent,
    PerlSockSetprotoent,
    PerlSockSetservent,
    PerlSockSetsockopt,
    PerlSockShutdown,
	PerlSockSocket,
    PerlSockSocketpair,
};

/* IPerlSock - Socket functions - End ====================================================*/

#endif /* ___NWPerlSys_H___ */