123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- /*
- * Licensed Materials - Property of IBM and/or HCL
- *
- * IBM Informix Dynamic Server
- * (c) Copyright IBM Corporation 1996, 2004 All rights reserved.
- * (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved.
- *
- ***************************************************************************
- *
- * Title: mistream.h
- * Description:
- * header file for the mi_stream Interface
- *
- ***************************************************************************
- */
- #ifndef _MISTREAM_H_
- #define _MISTREAM_H_
- #include "miconv.h"
- /*
- * mi_stream specific status (st_flags) control bits
- */
- #define MI_STREAM_EOF 0x0001 /* End of stream flag */
- #define MI_STREAM_MEM_ALLOCED 0x0002 /* MI_STREAM was allocated by */
- /* user and will not be */
- /* freed mi_stream_close. */
- /* For internal use only */
- #define MI_STREAM_NO_UDR_LOOKUP 0x0004 /* When set, UDR function */
- /* address lookup by name is */
- /* disabled, the related function */
- /* pointers will be used */
- typedef struct mi_stream MI_STREAM;
- /*
- * The stream operations and names below help stream manipulation. Not all the
- * functions need to be implemented. The ones not needed can be easily marked
- * as NULL. The ones needed must have related implementation for the stream
- * at hand.
- */
- #define OPS_NAME_LENGTH 40 /* max name for st_ops function name */
- typedef struct mi_stream_operations {
- /* the pointers to the functions */
- mi_integer (*close)(MI_STREAM *stream);
- mi_integer (*read)(MI_STREAM *stream, void *buf, mi_integer nbytes);
- mi_integer (*write)(MI_STREAM *stream, void *buf, mi_integer nbytes);
- mi_integer (*seek)(MI_STREAM *stream, mi_int8 *offset, int whence);
- mi_int8 * (*tell)(MI_STREAM *stream);
- mi_integer (*setpos)(MI_STREAM *stream, const mi_int8 *pos);
- mi_integer (*getpos)(MI_STREAM *stream, mi_int8 *pos);
- mi_integer (*length)(MI_STREAM *stream, mi_int8 *length);
- /* the names of the functions above */
- mi_char close_name [OPS_NAME_LENGTH];
- mi_char read_name [OPS_NAME_LENGTH];
- mi_char write_name [OPS_NAME_LENGTH];
- mi_char seek_name [OPS_NAME_LENGTH];
- mi_char tell_name [OPS_NAME_LENGTH];
- mi_char setpos_name[OPS_NAME_LENGTH];
- mi_char getpos_name[OPS_NAME_LENGTH];
- mi_char length_name[OPS_NAME_LENGTH];
- /* the function handles for the functions above */
- void *close_fhandle;
- void *read_fhandle;
- void *write_fhandle;
- void *seek_fhandle;
- void *tell_fhandle;
- void *setpos_fhandle;
- void *getpos_fhandle;
- void *length_fhandle;
- } mi_st_ops;
- typedef enum mi_stream_error_val
- {
- /*
- * mi_stream specific error status
- */
- MI_STREAM_EBADARG = -7400, /* Argument values have problem */
- MI_STREAM_EEOF = -7590, /* Reading past End Of File/stream marker */
- MI_STREAM_EFAIL = -7591, /* Generic failure */
- MI_STREAM_ENIMPL = -7592, /* Capability not implemented */
- MI_STREAM_ESENDFAIL = -7593, /* Send side failure */
- MI_STREAM_ERECEIVEFAIL = -7594, /* Receive side failure */
- MI_STREAM_EINT8 = -7595, /* Error in int8 operation */
- MI_STREAM_EWHENCE = -7596, /* Error in the "whence" value */
- MI_STREAM_ESAPI = -7597, /* SAPI Function module ID lookup failed */
- MI_STREAM_EBADSYM = -7598, /* Function symbol lookup failed */
- MI_STREAM_EBADFUNC = -7599, /* Function pointer lookup failed */
- /*
- * Negative status defines for mapping standard operating system
- * errno values. These are standard Informix error message values
- */
- MI_STREAM_EPERM = -1, /* Not super-user */
- MI_STREAM_ENOENT = -2, /* No such file or directory */
- MI_STREAM_ESRCH = -3, /* No such process */
- MI_STREAM_EINTR = -4, /* interrupted system call */
- MI_STREAM_EIO = -5, /* I/O error */
- MI_STREAM_ENXIO = -6, /* No such device or address */
- MI_STREAM_E2BIG = -7, /* Arg list too long */
- MI_STREAM_ENOEXEC = -8, /* Exec format error */
- MI_STREAM_EBADF = -9, /* Bad file number */
- MI_STREAM_ECHILD = -10, /* No children */
- MI_STREAM_EAGAIN = -11, /* Resource temporarily unavailable */
- MI_STREAM_ENOMEM = -12, /* Not enough core */
- MI_STREAM_EACCES = -13, /* Permission denied */
- MI_STREAM_EFAULT = -14, /* Bad address */
- MI_STREAM_ENOTBLK = -15, /* Block device required */
- MI_STREAM_EBUSY = -16, /* Mount device busy */
- MI_STREAM_EEXIST = -17, /* File exists */
- MI_STREAM_EXDEV = -18, /* Cross-device link */
- MI_STREAM_ENODEV = -19, /* No such device */
- MI_STREAM_ENOTDIR = -20, /* Not a directory */
- MI_STREAM_EISDIR = -21, /* Is a directory */
- MI_STREAM_EINVAL = -22, /* Invalid argument */
- MI_STREAM_ENFILE = -23, /* File table overflow */
- MI_STREAM_EMFILE = -24, /* Too many open files */
- MI_STREAM_ENOTTY = -25, /* Inappropriate ioctl for device */
- MI_STREAM_ETXTBSY = -26, /* Text file busy */
- MI_STREAM_EFBIG = -27, /* File too large */
- MI_STREAM_ENOSPC = -28, /* No space left on device */
- MI_STREAM_ESPIPE = -29, /* Illegal seek */
- MI_STREAM_EROFS = -30, /* Read only file system */
- MI_STREAM_EMLINK = -31, /* Too many links */
- MI_STREAM_EPIPE = -32, /* Broken pipe */
- MI_STREAM_EDOM = -33, /* Math arg out of domain of func */
- MI_STREAM_ERANGE = -34, /* Math result not representable */
- MI_STREAM_ENOMSG = -35 /* No message of desired type */
- } MI_STREAM_ERROR_VAL;
- /*
- * The public mi_stream inteface.
- */
- MI_DECL
- MI_STREAM * MI_PROC_EXPORT
- mi_stream_init ARGS ((struct mi_stream_operations * st_ops,
- void *st_data,
- MI_STREAM *stream));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_close ARGS ((MI_STREAM *stream));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_read ARGS ((MI_STREAM *stream,
- void *buf,
- mi_integer nbytes));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_write ARGS ((MI_STREAM *stream,
- void *buf,
- mi_integer nbytes));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_seek ARGS ((MI_STREAM *stream,
- mi_int8 *offset,
- int whence));
- MI_DECL
- mi_int8 * MI_PROC_EXPORT
- mi_stream_tell ARGS ((MI_STREAM *stream));
-
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_setpos ARGS ((MI_STREAM *stream,
- mi_int8 *pos));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_getpos ARGS ((MI_STREAM *stream,
- mi_int8 *pos));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_length ARGS ((MI_STREAM *stream,
- mi_int8 *length));
-
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_eof ARGS ((MI_STREAM *stream));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_set_error ARGS ((MI_STREAM *stream,mi_integer error));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_get_error ARGS ((MI_STREAM *stream));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_set_flags ARGS ((MI_STREAM *stream,mi_integer flags));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_get_flags ARGS ((MI_STREAM *stream));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_set_eof ARGS ((MI_STREAM *stream));
- MI_DECL
- mi_integer MI_PROC_EXPORT
- mi_stream_clear_eof ARGS ((MI_STREAM *stream));
- /* Get functions functions for accessing mi_stream internal
- * members. Typically used in stream implementation, not by
- * stream users.
- */
- /* get user defined data pointer */
- MI_DECL
- void * MI_PROC_EXPORT
- mi_stream_get_dataptr ARGS ((MI_STREAM *stream));
- /* get possition pointer */
- MI_DECL
- mi_int8 * MI_PROC_EXPORT
- mi_stream_get_posptr ARGS ((MI_STREAM *stream));
- #endif
|