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
|
/************************************************************************/
/* */
/* Operating system related functionality. */
/* */
/************************************************************************/
# ifndef APP_SYSTEM_H
# define APP_SYSTEM_H
typedef int (*FILE_CALLBACK) ( const char * name,
void * through );
typedef void (*APP_COMPLAIN)( void * through,
int errorId,
const char * errorSubject );
/************************************************************************/
/* */
/* Error numbers. (Can be transtaled to strings by the caller.) */
/* */
/************************************************************************/
# define APP_SYSTEMeNOERROR 0
# define APP_SYSTEMeNOMEM 1
# define APP_SYSTEMeFROM 2
# define APP_SYSTEMeRCPT 3
# define APP_SYSTEMeSMTP 4
# define APP_SYSTEMeWRITE 5
# define APP_SYSTEMeREAD 6
# define APP_SYSTEMeUNAME 7
# define APP_SYSTEMeHOST 8
# define APP_SYSTEMeSERV 9
# define APP_SYSTEMeSOCK 10
# define APP_SYSTEMeCONN 11
# define APP_SYSTEMeBIND 12
# define APP_SYSTEMeLISTEN 13
# define APP_SYSTEMeACCEPT 14
# define APP_SYSTEMeCOUNT 15
/************************************************************************/
/* */
/* Operating system related functionality.. Declarations. */
/* */
/************************************************************************/
extern int appHomeDirectory( char * home,
int len );
extern int appCurrentDirectory( char * pwd,
int len );
extern int appTestDirectory( const char * dir );
extern int appTestFileWritable( const char * file );
extern int appTestFileExists( const char * file );
extern int appTestFileReadable( const char * file );
extern int appMakeDirectory( const char * dir );
extern long appGetTimestamp( void );
extern int appMakeUniqueString( char * target,
int maxlen );
extern int appAbsoluteName( char * absolute,
int len,
const char * filename );
extern int appRemoveFile( const char * filename );
extern int appForAllFiles( const char * dir,
const char * ext,
void * through,
FILE_CALLBACK callback );
extern int appOpenSocket( const char * hostName,
const char * portName,
void * through,
APP_COMPLAIN complain );
extern int appListenSocket( const char * portName,
unsigned int * pPort,
void * through,
APP_COMPLAIN complain );
extern int appAcceptSocket( int lfd,
void * through,
APP_COMPLAIN complain );
# endif /* APP_SYSTEM_H */
|