source: git/MP/MP/h/MP_Env.h @ 61941e2

spielwiese
Last change on this file since 61941e2 was 61941e2, checked in by Olaf Bachmann <obachman@…>, 27 years ago
* added fork mode to MP TCP links git-svn-id: file:///usr/local/Singular/svn/trunk@370 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.0 KB
Line 
1/***************************************************************************
2 *                                                                 
3 *   HEADER FILE:  MP_Env.h
4 *
5 *        Declarations to maintain the MP environment.  The environment
6 *        includes the name of the host machine, the log file name and
7 *      file descriptor and the buffer pool containing all the buffers
8 *      to be shared among the links.  The initialization should be
9 *      done once before any MP-related activities occur.
10 *                                                               
11 *  Change Log:
12 *       September 10, 1995  SG - Updated implementation.  Much cleaning
13 *                                to make it presentable.
14 *       November 25, 1995   SG - Added field in env struct to support
15 *                                negotiation of endian order.
16 *       April 32, 1996      SG - Added support to handle different
17 *                                Big Integer packages.  See note in
18 *                                MP_SacBigInt.c for some details.
19 ***************************************************************************/
20#ifndef _MP_Env_h
21#define _MP_Env_h
22
23
24
25#include "MP.h"
26
27#define MP_HOST_NAME_LEN    64
28#define MP_INIT_LOGFILE_EXT 100
29
30/* These are the transport types currently supported   */
31/* These are the values stored in transp_dev.         */
32/* If you add to this list, you must also add a string */
33/* equivalent to transp_dev2string[] in MP_Link.c.    */
34
35#define MP_TcpTransportDev   0
36#define MP_FileTransportDev  1
37#define MP_PvmTransportDev   2
38#define MP_TbTransportDev    3
39
40
41/*
42 * Options that can be set for an environment
43 */
44#define MP_BUFFER_SIZE_OPT       1
45#define MP_MAX_FREE_BUFFERS_OPT  2
46#define MP_INIT_FREE_BUFFERS_OPT 3
47
48typedef struct  {
49    long         (*write_buf)();          /* write buffer to transport   */
50    long         (*read_buf)();           /* read transport to buffer    */
51    MP_Status_t  (*flush_buf)();          /* flush buffer to transport   */
52    MP_Boolean_t (*get_status)();         /* check status of the link    */
53    MP_Status_t  (*open_transp)();        /* open the transport device   */
54    MP_Status_t  (*close_transp)();       /* close the transport device  */
55} MP_TranspOps_t;
56
57
58typedef struct {
59    int            transp_dev;
60    MP_TranspOps_t *transp_ops;
61    char           *private1;    /* for opaque transport-specific structure */
62} MP_Transport_t;
63
64typedef struct transp_list_elem *MP_TranspList_pt;
65
66struct transp_list_elem {
67    int               transp_dev;
68    MP_TranspOps_t    transp_ops;
69    MP_TranspList_pt *next;
70};
71
72
73typedef struct mp_environment {
74    MP_TranspList_pt transp_dev_list; /* list of supported transport devices */
75    buffer_pool_pt   buff_pool;       /* buffer pool shared by  links in this
76                                       *  env 
77                                       */
78    int   num_o_buff;
79    int   buffer_size;                /* size of each buffer in the pool     */
80    int   max_free_buffers;           /* max number of free buffers in the
81                                       * pool
82                                       */
83
84    int   init_free_buffers;          /* initial number of free buffers in the
85                                       * pool
86                                       */
87
88    int   num_links;                  /* to handout unique link ids for this
89                                       * env
90                                       */
91
92    FILE  *logfd;                     /* log file for all logging events     */
93    char  *logfilename;
94    char  thishost[MP_HOST_NAME_LEN];
95    MP_Boolean_t initialized;         /* can't set options after env has been
96                                       * init
97                                       */
98
99    MP_WordOrder_t native_word_order; /* what this machine uses internally   */
100    MP_FpFormat_t  native_fp_format;  /* floating pnt format used internally */
101    MP_BigNum_t    bignum;            /* info on bignum package to be used   */
102} MP_Env_t;
103
104typedef MP_Env_t *MP_Env_pt;
105typedef MP_Env_pt MP_ENV;
106
107EXTERN MP_ENV MP_AllocateEnv _ANSI_ARGS_((void));
108EXTERN MP_ENV MP_InitializeEnv _ANSI_ARGS_((MP_Env_pt env));
109EXTERN void MP_ReleaseEnv _ANSI_ARGS_((MP_Env_pt env));
110EXTERN int MP_SetEnvOption _ANSI_ARGS_((MP_Env_pt env, int option, int value));
111EXTERN int    MP_GetEnvOption _ANSI_ARGS_((MP_Env_pt env, int option));
112EXTERN MP_TranspList_pt IMP_GetTranspByName _ANSI_ARGS_((MP_Env_pt env, 
113                                                         int transp_dev));
114EXTERN MP_Status_t MP_AddEnvTranspDevice _ANSI_ARGS_((MP_Env_pt env, 
115                                        int transp_dev, MP_TranspOps_t *ops));
116EXTERN MP_Status_t MP_SetEnvBigIntFormat _ANSI_ARGS_((MP_Env_t *env, 
117                             MP_BigIntOps_t *ops, MP_BigNumFormat_t format));
118EXTERN MP_Status_t MP_SetEnvBigRealFormat _ANSI_ARGS_((MP_Env_t *env, 
119                             MP_BigRealOps_t *ops, MP_BigNumFormat_t format));
120EXTERN MP_Status_t open_logfile _ANSI_ARGS_((MP_ENV env));
121#endif /* _MP_Env_h */
Note: See TracBrowser for help on using the repository browser.