1/* *****************************************************************************
2
3libcsc: Main Header File
4
5	----------------------------------------------------------------
6
7Copyright (c) 2001, 2002 Douglas R. Jerome, Peoria, AZ USA
8
9	This program is free software; you can redistribute it and/or modify
10	it under the terms of the GNU Library General Public License as
11	published by the Free Software Foundation; either version 2 of the
12	License, or (at your option) any later version.
13
14	This program is distributed in the hope that it will be useful,
15	but WITHOUT ANY WARRANTY; without even the implied warranty of
16	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17	GNU General Public License for more details.
18
19	You should have received a copy of the GNU Library General Public
20	License along with this program; if not, write to the Free Software
21	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23	----------------------------------------------------------------
24
25FILE NAME
26
27	$RCSfile: libcsc.h,v $
28	$Revision: 1.9 $
29	$Date: 2003/03/24 04:08:00 $
30
31PROGRAM INFORMATION
32
33	Developed by:	libcsc project
34	Developer:	Douglas R. Jerome, drj, <jerome@primenet.com>
35
36FILE DESCRIPTION
37
38	This is the main libcsc header file. This file contains libcsc external
39	data and functions that are exported for libcsc client code.
40
41CHANGE LOG
42
43	23mar03	drj	Added CSCmemListType argument to CSChashEntryGet() and
44			CSCsymtabEntryGet().
45
46	03may02	drj	Small comment changes.
47
48	23apr02	drj	Changed several subsystems function prototypes.
49
50	20apr02	drj	Fixed list subsystem prototypes.
51
52	18apr02	drj	Added symbol table subsystem.
53
54	15apr02	drj	Added hash and math subsystems.
55
56	13apr02	drj	Added CSCsysUsleep().
57
58	11apr02	drj	Added binary tree subsystem.
59
60	16feb02	drj	Added list subsystem.
61
62	25jun01	drj	File generation.
63
64***************************************************************************** */
65
66
67#ifndef __libcsch
68#define __libcsch
69
70
71#ifdef	__cplusplus
72extern	"C"	{
73#endif
74
75
76/* ************************************************************************* */
77/*                                                                           */
78/*      I n c l u d e d   F i l e s                                          */
79/*                                                                           */
80/* ************************************************************************* */
81
82#include	<stdlib.h>    /* for calloc() and free() */
83#include	<stdio.h>     /* for FILE */
84#include	<unistd.h>
85#include	<sys/types.h> /* for off_t */
86
87
88/* ************************************************************************* */
89/*                                                                           */
90/*      M a n i f e s t   C o n s t a n t s                                  */
91/*                                                                           */
92/* ************************************************************************* */
93
94#define	PRIVATE	static	/* Use this when static really means private. */
95#define	PUBLIC		/* This tags exported functions and data.     */
96
97#define	CSC_MALLOC_FUNC(x,y)	calloc(x,y)
98#define	CSC_FREE_FUNC(x)	free(x)
99
100/* misc function wrapper subsystem */
101#define	CSC_STREQ(s1,s2)	(strcmp(s1,s2)==0)
102#define	CSC_STRNEQ(s1,s2)	(strcmp(s1,s2)!=0)
103
104/* hash table subsystem */
105#define	CSChashPrint(x)		CSChashWrite(STDOUT_FILENO,x)
106
107/* list subsystem */
108#define	CSClistScan(x)		CSClistRead(STDIN_FILENO,x)
109#define	CSClistPrint(x)		CSClistWrite(STDOUT_FILENO,x)
110
111/* symbol subsystem */
112#define	CSCsymbolIntPrint(x)	CSCsymbolIntWrite(STDOUT_FILENO,x)
113#define	CSCsymbolFloatPrint(x)	CSCsymbolFloatWrite(STDOUT_FILENO,x)
114#define	CSCsymbolPtrPrint(x)	CSCsymbolPtrWrite(STDOUT_FILENO,x)
115
116
117/* ************************************************************************* */
118/*                                                                           */
119/*      S c a l a r   D a t a   T y p e s                                    */
120/*                                                                           */
121/* ************************************************************************* */
122
123/*
124 * These are compiler dependent scalar data types.
125 */
126
127typedef   unsigned int     uint32;
128typedef   int               int32;
129
130typedef   unsigned short   uint16;
131typedef   short             int16;
132
133typedef   unsigned char    uint8;
134typedef   char              int8;
135
136/*
137 * The following enumerations may be used to flag binary switches; there is
138 * also a null state for some of these, which makes them tri-state.
139 */
140
141typedef enum
142   {
143   CSC_IO_INPUT = 0, CSC_IO_OUTPUT = 1, CSC_IO_NULL = 2
144   } CSCioDeviceType;
145
146typedef enum
147   {
148   CSC_IN = 0, CSC_OUT = 1
149   } CSCioSwitchType;
150
151typedef enum
152   {
153   CSC_FALSE = 0, CSC_TRUE = 1, CSC_INDETERMINATE = 2
154   } CSCboolean;
155
156typedef enum
157   {
158   CSC_OFF = 0, CSC_ON = 1, CSC_HIGH_Z = 2
159   } CSConOffType;
160
161typedef enum
162   {
163   CSC_FAIL = 0, CSC_PASS = 1, CSC_UNGRADED = 2
164   } CSCpassFailType;
165
166/*
167 * These enumerations are the collection of function arguments that are given
168 * to various libcsc functions.
169 */
170
171typedef enum
172   {
173   CSC_NO_PROFILING = 0, CSC_DO_PROFILING   = 1,
174   CSC_SHOW_ALL     = 2, CSC_SHOW_ALLOCATED = 3
175   } CSCprofileType;
176
177/*
178 * These are used to specify to restart or not to restart interrupted slow
179 * system calls.
180 */
181typedef enum
182   {
183   CSC_SIG_INTERRUPT, CSC_SIG_RESTART
184   } CSCsigModeType;
185
186/*
187 * These flags are used as arguments to some of the csc functions.  Some of the
188 * csc subsystems' functions operate with user's data passed to them as an
189 * argument; this client data may be directly used, duplicated, or removed
190 * depending upon the value of a flag argument.  These are the values of the
191 * flag arguments:
192 */
193typedef enum
194   {
195   CSC_DATA_OK    = 0,
196   CSC_DATA_NODUP = 0x4E4F434F,
197   CSC_DATA_DUP   = 0x434F5043,
198   CSC_DATA_RM    = 0x524D4441
199   } CSCdataCntrlType;
200
201/*
202 * Hash table key types; these specify the type of key used by a particlar hash
203 * table.
204 */
205typedef enum
206   {
207   CSC_HASH_ASCIIZ_KEY = 0x41734349,
208   CSC_HASH_INT32_KEY  = 0x494E5431
209   } CSChashKeyType;
210
211/*
212 * Some list operations work on the front (head) or back (tail) of a list;
213 * these are used to specify such.
214 */
215typedef enum
216   {
217   CSC_LIST_HEAD = 0x48454144,
218   CSC_LIST_TAIL = 0x5441494C
219   } CSClistBiasType;
220
221/*
222 * This enumeration is the collection of return values that are returned by
223 * libcsc functions.
224 */
225
226typedef enum
227   {
228   CSC_ERROR    = -1, /* general error         */
229   CSC_OK       = 0,  /* all ok                */
230   CSC_BADARG   = 1,  /* bad argument          */
231   CSC_CORRUPT  = 2,  /* internal corruption   */
232   CSC_NOMEM    = 3,  /* can't allocate memory */
233   CSC_NOTFOUND = 4,  /* can't find item       */
234   CSC_NOSVC    = 5,  /* no service available  */
235   CSC_NOPROT   = 6,  /* no protocol available */
236   CSC_NOSOCK   = 7,  /* no socket available   */
237   CSC_NOBIND   = 8,  /* can't bind something  */
238   CSC_NOLISTEN = 9,  /* listen() failed       */
239   CSC_DUPKEY   = 10  /* duplicate key         */
240   } CSCstatusType;
241
242/*
243 * Some csc subsystems make use of client callback functions. Client code
244 * provides function pointers (callbacks) and csc subsystems will invoke the
245 * client functions via these function callback pointers. These are the
246 * types of callbacks and what they are asked to do.
247 *      compare - compare two void pointers
248 *      general - accept data (probably status) from subsystem
249 *      monitor - critical region locking
250 *      tag     - return a string (const char*) corresponding to an integer
251 *
252 * The function pointers are typedef'ed here:
253 */
254typedef int           (*CSCcmpFnType)(void*,void*);           /* compare */
255typedef int           (*CSCgenFnType)(int,int,void*);         /* general */
256typedef int           (*CSCmonFnType)(CSCioSwitchType,void*); /* monitor */
257typedef void          (*CSCsigFnType)(int);                   /* signal  */
258typedef const char*   (*CSCtagFnType)(int);                   /* tag     */
259
260
261/* ************************************************************************* */
262/*                                                                           */
263/*      N o n - S c a l a r   D a t a   S t r u c t u r e s                  */
264/*                                                                           */
265/* ************************************************************************* */
266
267/*
268 * The following are some opaque data types for some of the various subsystems.
269 */
270
271/* -- Binary Tree Subsystem */
272
273typedef   struct S_binTreeType*       CSCbinTreeType;
274typedef   struct S_binTreeNodeType*   CSCbinTreeNodeType;
275
276/* -- Hash Table Subsystem*/
277
278typedef struct   CSChashStatType
279   {
280   char             name[80];
281   CSCprofileType   profiling;
282   size_t           count;
283   size_t           nhash;
284   CSCboolean       grows;
285   size_t           resizes;
286   size_t           deletions;
287   size_t           insertions;
288   size_t           collisions;
289   } CSChashStatType;
290
291typedef union S_hashKeyUnion
292   {
293   int32   integer;
294   char*   asciiz;
295   } S_hashKeyUnion;
296
297typedef   union  S_hashKeyUnion     CSChashKeyUnion;
298typedef   struct S_hashEntryType*   CSChashEntryType;
299typedef   struct S_hashTableType*   CSChashTableType;
300
301/* -- List Subsystem */
302
303typedef   struct S_listType*       CSClistType;
304typedef   struct S_listNodeType*   CSClistNodeType;
305
306/* -- Memory Subsystem */
307
308typedef   struct S_memListType*   CSCmemListType;
309
310/* -- Notification System Subsystem */
311
312typedef   struct S_notifBoardType*   CSCnotificationBoardType;
313
314/* -- Symbol Subsystem */
315
316/*
317 * The libcsc symbol subsystem does not use an opaque data type, symbol
318 * subsystem client code is free to use the symbol structure; this subsystem
319 * originally was nothing more than some definitions in a header file, but,
320 * as you can find in the function prototypes below, there are now some simple
321 * helper functions in the libcsc symbol subsystem.
322 */
323typedef struct symbol
324   {
325   char*    name;
326   long     type;
327   int      valueFlag; /* 1=>integer, 2=>float, 3=>pointer */
328   size_t   dvSize;
329   union
330      {
331      int     integer; /* => valueFlag == 1 */
332      float   real;    /* => valueFlag == 2 */
333      void*   pointer; /* => valueFlag == 3 */
334      } value;
335   } CSCsymbolType;
336
337/* -- Symbol Table Subsystem */
338
339typedef   struct S_symTableType*   CSCsymTableType;
340
341/* -- Timer Subsystem */
342
343typedef   struct S_timerType*   CSCtimerType;
344
345
346/* ************************************************************************* */
347/*                                                                           */
348/*      P u b l i c   G l o b a l   V a r i a b l e s                        */
349/*                                                                           */
350/* ************************************************************************* */
351
352/*  (None.)  */
353
354
355/* ************************************************************************* */
356/*                                                                           */
357/*      F u n c t i o n   P r o t o t y p e s                                */
358/*                                                                           */
359/* ************************************************************************* */
360
361/* -- libcsc Configuration and General Function Prototypes */
362
363PUBLIC const char*   CSCstatStr (int status);
364PUBLIC const char*   CSCcflags (void);
365PUBLIC const char*   CSCldflags (void);
366PUBLIC const char*   CSClibs (void);
367PUBLIC const char*   CSCcredits (void);
368PUBLIC const char*   CSCversion (void);
369PUBLIC void          CSCchkup (void);
370
371/* -- Binary Tree Subsystem Function Prototypes */
372
373PUBLIC CSCbinTreeType   CSCbinTreeNew (
374                                      const char*            namePtr,
375                                            CSCmonFnType     monFunc,
376                                      const void*            monData,
377                                            CSCprofileType   profiling
378                                      );
379
380PUBLIC int   CSCbinTreeDel (
381                           CSCbinTreeType   const tree,
382                           CSCgenFnType           cbFn
383                           );
384
385PUBLIC int   CSCbinTreeInsert (
386                              CSCbinTreeType       const tree,
387                              CSCbinTreeNodeType   const node,
388                              CSCcmpFnType               cmpfn
389                              );
390
391PUBLIC int   CSCbinTreeTagOrderedInsert (
392                                        CSCbinTreeType       const tree,
393                                        CSCbinTreeNodeType   const node
394                                        );
395
396PUBLIC int   CSCbinTreeTraverse (
397                                const char*            const method,
398                                      CSCbinTreeType   const tree,
399                                      CSCcmpFnType           clientFn,
400                                const void*            const clientData
401                                );
402
403PUBLIC CSCbinTreeNodeType   CSCbinTreeUserSearch (
404                                               CSCbinTreeType   const tree,
405                                               CSCcmpFnType           clientFn,
406                                         const void*            const clientData
407                                                 );
408
409PUBLIC CSCbinTreeNodeType   CSCbinTreeTagSearch (
410                                                CSCbinTreeType   const tree,
411                                                long                   tag
412                                                );
413
414PUBLIC int   CSCbinTreeStat (
415                            CSCbinTreeType   const tree,
416                            size_t*          const countPtr,
417                            size_t*          const heightPtr,
418                            size_t*          const comparesPtr,
419                            size_t*          const rotatesPtr
420                            );
421
422PUBLIC int   CSCbinTreePrint (
423                             CSCbinTreeType   const tree
424                             );
425
426PUBLIC CSCbinTreeNodeType   CSCbinTreeNodeNew (
427                                               CSCdataCntrlType         push,
428                                               long                     tag,
429                                         const void*              const dataPtr,
430                                               size_t                   dataSize
431                                              );
432
433PUBLIC int   CSCbinTreeNodeDel (
434                               CSCbinTreeNodeType   const node
435                               );
436
437PUBLIC int   CSCbinTreeNodeJoin (
438                                CSCbinTreeNodeType   const node,
439                                CSCbinTreeNodeType   const left,
440                                CSCbinTreeNodeType   const right
441                                );
442
443PUBLIC int   CSCbinTreeNodeBreak (
444                                 CSCbinTreeNodeType    const node,
445                                 CSCbinTreeNodeType*   const leftPtr,
446                                 CSCbinTreeNodeType*   const rightPtr
447                                 );
448
449PUBLIC int   CSCbinTreeNodeTraverse (
450                                    const char*                const method,
451                                          CSCbinTreeNodeType   const node,
452                                          CSCcmpFnType               clientFn,
453                                    const void*                const clientData
454                                    );
455
456PUBLIC CSCbinTreeNodeType   CSCbinTreeNodeUserSearch (
457                                           CSCbinTreeNodeType   const node,
458                                           CSCcmpFnType               clientFn,
459                                     const void*                const clientData
460                                                     );
461
462PUBLIC CSCbinTreeNodeType   CSCbinTreeNodeTagSearch (
463                                                CSCbinTreeNodeType   const node,
464                                                long                       tag
465                                                    );
466
467PUBLIC int   CSCbinTreeNodeStat (
468                                CSCbinTreeNodeType   const node,
469                                CSCdataCntrlType*    const pushPtr,
470                                long*                const tagPtr,
471                                size_t*              const sizePtr,
472                                void**               const dataPtrPtr
473                                );
474
475PUBLIC int   CSCbinTreeNodePrint (
476                                 CSCbinTreeNodeType   const node
477                                 );
478
479/* -- File Subsystem Function Prototypes */
480
481PUBLIC int   CSCfileReadLock (int fd, off_t offset, int whence, off_t length);
482PUBLIC int   CSCfileWriteLock (int fd, off_t offset, int whence, off_t length);
483PUBLIC int   CSCfileUnlock (int fd, off_t offset, int whence, off_t length);
484
485PUBLIC char*   CSCfileGetHomeDir (
486                                 const size_t                 pathSize,
487                                       CSCmemListType   const memList,
488                                       int                    memTag
489                                 );
490
491PUBLIC char*   CSCfileGetUserHomeDir (
492                                     const char*            const userName,
493                                     const size_t                 pathSize,
494                                           CSCmemListType   const memList,
495                                           int                    memTag
496                                     );
497
498PUBLIC char*   CSCfileBaseName (
499                               const char*            const path,
500                                     CSCmemListType   const memList,
501                                     int                    memTag
502                               );
503
504PUBLIC char*   CSCfilePathName (
505                               const char*            const path,
506                                     CSCmemListType   const memList,
507                                     int                    memTag
508                               );
509
510PUBLIC char*   CSCfileExpandPath (
511                                 const char*            const path,
512                                 const size_t                 pathMax,
513                                       CSCmemListType   const memList,
514                                       int                    memTag
515                                 );
516
517PUBLIC FILE*   CSCfileOpen (
518                           const char*            const path,
519                           const int                    mask,
520                           const size_t                 pathMax,
521                                 CSCmemListType   const memList,
522                                 int                    memTag
523                           );
524
525/* -- Hash Table Subsystem Function Prototypes */
526
527PUBLIC CSChashTableType   CSChashNew (
528                                     const char*            const namePtr,
529                                           CSChashKeyType         keySpec,
530                                           size_t                 size,
531                                           CSCmonFnType           monFunc,
532                                     const void*                  monData,
533                                           CSCprofileType         profiling
534                                       );
535
536PUBLIC int   CSChashDel (
537                        CSChashTableType   const hashTable
538                        );
539
540PUBLIC int   CSChashStat (
541                         CSChashTableType   const hashTable,
542                         CSChashStatType*   const statStruct
543                         );
544
545PUBLIC int   CSChashEntryPut (
546                             CSChashTableType   const hashTable,
547                             CSChashKeyUnion*   const keyPtr,
548                             void*              const itemPtr,
549                             size_t                   itemSize
550                             );
551
552PUBLIC int   CSChashEntryGet (
553                             CSChashTableType   const hashTable,
554                             CSChashKeyUnion*   const keyPtr,
555                             void**             const itemPtrPtr,
556                             size_t*            const itemSizePtr,
557                             CSCmemListType     const memLst
558                             );
559
560PUBLIC int   CSChashEntryDel (
561                             CSChashTableType   const hashTable,
562                             CSChashKeyUnion*   const keyPtr
563                             );
564
565PUBLIC CSChashEntryType   CSChashEntryNext (
566                                           CSChashTableType   const hashTable,
567                                           CSChashEntryType   const entry
568                                           );
569
570PUBLIC int   CSChashEntryStat (
571                              CSChashEntryType    const entry,
572                              CSChashKeyUnion**   const keyPtrPtr,
573                              void**              const itemPtrPtr,
574                              size_t*             const itemSizePtr
575                              );
576
577PUBLIC int   CSChashRead (
578                               int                       fd,
579                               CSChashTableType*   const hashTablePtr,
580                               CSCmonFnType              monFunc,
581                         const void*                     monData,
582                               CSCprofileType            profiling
583                         );
584
585PUBLIC int   CSChashWrite (
586                          int                      fd,
587                          CSChashTableType   const hashTable
588                          );
589
590PUBLIC int   CSChashDump (
591                         int                      fd,
592                         CSChashTableType   const hashTable
593                         );
594
595/* -- I/O Subsystem Function Prototypes */
596
597PUBLIC void   CSCioInfoPrint (
598                             const char*   cscPtr,
599                             const char*   csuPtr,
600                             const char*   fmtPtr,
601                             ...
602                             );
603
604PUBLIC void   CSCioWarnPrint (
605                             const char*   cscPtr,
606                             const char*   csuPtr,
607                             const char*   fmtPtr,
608                             ...
609                             );
610
611PUBLIC void   CSCioErrorPrint (
612                              const char*   cscPtr,
613                              const char*   csuPtr,
614                              const char*   fmtPtr,
615                              ...
616                              );
617
618PUBLIC void   CSCioSoftwareError (
619                                 const char*   identPtr,
620                                 const char*   csciPtr,
621                                 const char*   fmtPtr,
622                                 ...
623                                 );
624
625PUBLIC int   CSCioRead (
626                       int            fd,
627                       char*    const bufPtr,
628                       size_t         size
629                       );
630
631PUBLIC int   CSCioReadLine (
632                           int                    fd,
633                           char**           const bufPtrPtr,
634                           CSCmemListType   const memList,
635                           int                    tagData
636                           );
637
638PUBLIC int   CSCioBufWrite (
639                                 int      fd,
640                           const void*    dataPtr,
641                                 size_t   size
642                           );
643
644PUBLIC int   CSCioBufRead (
645                          int                    fd,
646                          void**           const dataPtrPtr,
647                          size_t*          const sizePtr,
648                          CSCmemListType   const memList,
649                          int                    tagData
650                          );
651
652/* -- List Subsystem Function Prototypes */
653
654PUBLIC CSClistType   CSClistNew (
655                                const char*            namePtr,
656                                      CSCmonFnType     monFunc,
657                                const void*            monData,
658                                      CSCprofileType   profiling
659                                );
660
661PUBLIC int   CSClistDel (CSClistType const list);
662
663PUBLIC int   CSClistRead (
664                         int                 fd,
665                         CSClistType   const list
666                         );
667
668PUBLIC int   CSClistWrite (
669                          int                 fd,
670                          CSClistType   const list
671                          );
672
673PUBLIC int   CSClistSetCFunc (
674                             CSClistType    const list,
675                             CSCcmpFnType         funcptr
676                             );
677
678PUBLIC int   CSClistStat (
679                         CSClistType   const list,
680                         size_t*       const pushCountPtr,
681                         size_t*       const popCountPtr,
682                         size_t*       const maxAllocPtr,
683                         size_t*       const curAllocPtr
684                         );
685
686PUBLIC int   CSClistPush (
687                               CSClistType        const list,
688                               CSCdataCntrlType         push,
689                         const void*              const itemPtr,
690                         const size_t                   itemSize
691                         );
692
693PUBLIC int   CSClistPop (
694                        CSClistType       const list,
695                        CSClistBiasType         bias,
696                        void**            const itemPtrPtr,
697                        size_t*           const itemSizePtr
698                        );
699
700PUBLIC int   CSClistPeek (
701                         CSClistType       const list,
702                         CSClistBiasType         bias,
703                         void**            const itemPtrPtr,
704                         size_t*           const itemSizePtr
705                         );
706
707PUBLIC CSClistNodeType   CSClistNodeNext (
708                                         CSClistType       const list,
709                                         CSClistBiasType         bias,
710                                         CSClistNodeType         node
711                                         );
712
713PUBLIC CSClistNodeType   CSClistNodeFindByValue (
714                                                CSClistType       const list,
715                                                CSClistBiasType         bias,
716                                          const void*             const itemPtr
717                                                );
718
719PUBLIC CSClistNodeType   CSClistNodeFindByReference (
720                                                CSClistType       const list,
721                                                CSClistBiasType         bias,
722                                          const void*             const itemPtr
723                                                    );
724
725PUBLIC int   CSClistNodeStat (
726                             CSClistNodeType   const node,
727                             void**            const itemPtrPtr,
728                             size_t*           const itemSizePtr
729                             );
730
731PUBLIC int   CSClistNodeValidate (
732                                  CSClistType       const list,
733                                  CSClistNodeType   const node
734                                  );
735
736PUBLIC int   CSClistNodeDel (
737                            CSClistType       const list,
738                            CSClistNodeType         node
739                            );
740
741
742/* -- Math Subsystem Function Prototypes */
743
744PUBLIC int   CSC2x (int exp);
745
746PUBLIC int   CSCurand (int y, double* dptr);
747
748/* -- Memory (Dynamic Allocation) Subsystem Function Prototypes */
749
750PUBLIC CSCmemListType   CSCmemInit (
751                                   const char*            namePtr,
752                                         CSCtagFnType     tagFunc,
753                                         CSCmonFnType     monFunc,
754                                   const void*            monData,
755                                         CSCprofileType   profiling
756                                   );
757
758PUBLIC int   CSCmemDone (CSCmemListType const memList);
759
760PUBLIC int   CSCmemAlloc (
761                         CSCmemListType   const memList,
762                         void**           const memPtrPtr,
763                         size_t                 itemCount,
764                         size_t                 itemSize,
765                         int                    tagData
766                         );
767
768PUBLIC int   CSCmemDup (
769                             CSCmemListType   const memList,
770                             void**           const dstPtrPtr,
771                       const void*                  srcPtr,
772                             size_t                 size,
773                             int                    tagData
774                       );
775
776PUBLIC int   CSCmemLookup (
777                                CSCmemListType   const memList,
778                          const void*                  memPtr,
779                                size_t*          const sizePtr,
780                                int*             const tagPtr
781                          );
782
783PUBLIC int   CSCmemValidate (
784                                  CSCmemListType   const memList,
785                            const void*                  memPtr
786                            );
787
788PUBLIC int   CSCmemFree (
789                        CSCmemListType   const memList,
790                        void**           const memPtrPtr,
791                        int                    tagData
792                        );
793
794PUBLIC int   CSCmemListFree (
795                            CSCmemListType   const memList,
796                            int                    tagData
797                            );
798
799PUBLIC int   CSCmemListStat (
800                            CSCmemListType   const memList,
801                            size_t*          const allocCountPtr,
802                            size_t*          const freeCountPtr,
803                            size_t*          const maxMemAllocPtr,
804                            size_t*          const curMemAllocPtr
805                            );
806
807PUBLIC int   CSCmemListPrintProfile (
808                                    CSCmemListType   const memList,
809                                    CSCprofileType         showing
810                                    );
811
812PUBLIC int   CSCmemListWriteProfile (
813                                    CSCmemListType   const memList,
814                                    int                    fd,
815                                    CSCprofileType         showing
816                                    );
817
818/* -- Notification System Subsystem */
819
820PUBLIC CSCnotificationBoardType   CSCnotificationBoardNew (
821                                                const char*            namePtr,
822                                                      CSCmonFnType     monFunc,
823                                                const void*            monData,
824                                                      CSCprofileType   profiling
825                                                          );
826
827PUBLIC int   CSCnotificationBoardDel (
828                                     CSCnotificationBoardType   const board
829                                     );
830
831PUBLIC int   CSCnotificationNew (
832                                      CSCnotificationBoardType   const board,
833                                const char*                            namePtr,
834                                      CSCgenFnType                     errfn
835                                );
836
837PUBLIC int   CSCnotificationDel (
838                                      CSCnotificationBoardType   const board,
839                                const char*                            namePtr
840                                );
841
842PUBLIC int   CSCnotificationPost (
843                                       CSCnotificationBoardType   const board,
844                                 const char*                            namePtr
845                                 );
846
847PUBLIC int   CSCnotificationRegister (
848                                  CSCnotificationBoardType   const board,
849                            const char*                            notifName,
850                            const char*                            clientName,
851                                  CSCgenFnType                     fn,
852                            const CSCboolean*                      runFlag,
853                                  int                              tag,
854                            const void*                            data
855                                     );
856
857PUBLIC void   CSCnotificationBoardPrint (
858                                        CSCnotificationBoardType   const board
859                                        );
860
861/* -- BSD Socket Subsystem Function Prototypes */
862
863PUBLIC int   CSCsockConnectTCP (
864                                     int*           const socketPtr,
865                               const char*                host,
866                               const char*                service,
867                                     CSCgenFnType         errorCallback
868                               );
869
870PUBLIC int   CSCsockConnectUDP (
871                                     int*           const socketPtr,
872                               const char*                host,
873                               const char*                service,
874                                     CSCgenFnType         errorCallback
875                               );
876
877PUBLIC int   CSCsockPassiveTCP (
878                                     int*           const socketPtr,
879                               const char*                service,
880                                     int                  connectCount,
881                                     CSCgenFnType         errorCallback
882                               );
883
884PUBLIC int   CSCsockPassiveUDP (
885                                     int*           const socketPtr,
886                               const char*                service,
887                                     int                  connectCount,
888                                     CSCgenFnType         errorCallback
889                               );
890
891/* -- String Subsystem Function Prototypes */
892
893PUBLIC char*   CSCstringOctal (
894                              char*   const bufPtr,
895                              int32         item
896                              );
897
898PUBLIC char*   CSCstringBinary (
899                               char*   const bufPtr,
900                               int32         item
901                               );
902
903PUBLIC char*   CSCstringBasename (
904                                 char**   const pathPtrPtr
905                                 );
906
907/* -- Symbol Subsystem Function Prototypes */
908
909PUBLIC int   CSCsymbolIntInit (
910                                    CSCsymbolType*   const symbol,
911                              const char*            const symName,
912                                    long                   symType,
913                                    int                    symVal
914                              );
915
916PUBLIC int   CSCsymbolFloatInit (
917                                      CSCsymbolType*   const symbol,
918                                const char*            const symName,
919                                      long                   symType,
920                                      float                  symVal
921                                );
922
923PUBLIC int   CSCsymbolPtrInit (
924                                    CSCsymbolType*   const symbol,
925                              const char*            const symName,
926                                    long                   symType,
927                              const void*                  symVal,
928                                    size_t                 symValSize
929                              );
930
931PUBLIC CSCsymbolType*   CSCsymbolIntNew (
932                                        const char*            const symName,
933                                              long                   symType,
934                                              int                    symVal,
935                                              CSCmemListType   const memList,
936                                              int                    memTag
937                                        );
938
939PUBLIC CSCsymbolType*   CSCsymbolFloatNew (
940                                          const char*           const symName,
941                                                long                  symType,
942                                                float                 symVal,
943                                                CSCmemListType  const memList,
944                                                int                   memTag
945                                          );
946
947PUBLIC CSCsymbolType*   CSCsymbolPtrNew (
948                                         const char*           const symName,
949                                               long                  symType,
950                                         const void*                 symVal,
951                                               size_t                symValSize,
952                                               CSCmemListType  const memList,
953                                               int                   memTag
954                                          );
955
956PUBLIC int   CSCsymbolIntDel (
957                             CSCsymbolType**   const symPtrPtr,
958                             CSCmemListType    const memList,
959                             int                     memTag
960                             );
961
962PUBLIC int   CSCsymbolFloatDel (
963                               CSCsymbolType**   const symPtrPtr,
964                               CSCmemListType    const memList,
965                               int                     memTag
966                               );
967
968PUBLIC int   CSCsymbolPtrDel (
969                             CSCsymbolType**   const symPtrPtr,
970                             CSCmemListType    const memList,
971                             int                     memTag
972                             );
973
974PUBLIC int   CSCsymbolIntWrite (
975                               const int                    fd,
976                               const CSCsymbolType*   const symPtr
977                               );
978
979PUBLIC int   CSCsymbolFloatWrite (
980                                 const int                    fd,
981                                 const CSCsymbolType*   const symPtr
982                                 );
983
984PUBLIC int   CSCsymbolPtrWrite (
985                               const int                    fd,
986                               const CSCsymbolType*   const symPtr
987                               );
988
989PUBLIC CSCsymbolType*   CSCsymbolDup (
990                                     const CSCsymbolType*   const symPtr,
991                                           CSCmemListType   const memList,
992                                           int                    memTag
993                                     );
994
995PUBLIC int   CSCsymbolDel (
996                          CSCsymbolType**   const symPtrPtr,
997                          CSCmemListType    const memList,
998                          int                     memTag
999                          );
1000
1001/* -- Symbol Table Subsystem Function Prototypes */
1002
1003PUBLIC CSCsymTableType   CSCsymtabNew (
1004                                      const char*          const namePtr,
1005                                            size_t               size,
1006                                      const char**               keyWords,
1007                                            int                  keyWordSpec,
1008                                            CSCmonFnType         monFunc,
1009                                      const void*                monData,
1010                                            CSCprofileType       profiling
1011                                      );
1012
1013PUBLIC int   CSCsymtabDel (
1014                          CSCsymTableType   const symTab
1015                          );
1016
1017PUBLIC int   CSCsymtabStat (
1018                           CSCsymTableType   const symTab,
1019                           size_t*           const sizePtr
1020                           );
1021
1022PUBLIC int   CSCsymtabEntryPut (
1023                               CSCsymTableType   const symTab,
1024                               CSCsymbolType*    const symbol
1025                               );
1026
1027PUBLIC CSCsymbolType*   CSCsymtabEntryGet (
1028                                          CSCsymTableType   const symTab,
1029                                          char*             const symName,
1030                                          CSCmemListType     const memLst
1031                                          );
1032
1033PUBLIC int   CSCsymtabEntryDel (
1034                               CSCsymTableType   const symTab,
1035                               char*             const symName
1036                               );
1037
1038PUBLIC void*   CSCsymtabEntryNext (
1039                                  CSCsymTableType   const symTab,
1040                                  void*             const lhPtr
1041                                  );
1042
1043/* -- System Subsystem Function Prototypes */
1044
1045PUBLIC int   CSCsysLimitsGet (
1046                             int*    const fileOpenMaxPtr,
1047                             int*    const fileNameLengthPtr,
1048                             int*    const filePathLengthPtr
1049                             );
1050
1051PUBLIC CSCsigFnType   CSCsysInstallSignal (
1052                                          const int              signo,
1053                                          const CSCsigFnType     func,
1054                                          const CSCsigModeType   mode
1055                                          );
1056
1057PUBLIC void   CSCsysUsleep (
1058                           const size_t   microseconds
1059                           );
1060
1061/* -- Timer Subsystem Function Prototypes */
1062
1063PUBLIC CSCtimerType   CSCtimerInit (void);
1064
1065PUBLIC int   CSCtimerDone (CSCtimerType const timer);
1066
1067PUBLIC int   CSCtimerClear (CSCtimerType const timer);
1068
1069PUBLIC int   CSCtimerMark (CSCtimerType const timer);
1070
1071PUBLIC int   CSCtimerDiff (
1072                          CSCtimerType   const timer,
1073                          double*        const diffPtr
1074                          );
1075
1076PUBLIC int   CSCtimerStat (
1077                          CSCtimerType   const timer,
1078                          double*        const diffPtr
1079                          );
1080
1081
1082#ifdef	__cplusplus
1083}
1084#endif
1085
1086
1087#endif
1088