source: git/MP/MP/h/MP_Link.h @ 554c78c

fieker-DuValspielwiese
Last change on this file since 554c78c was 554c78c, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes/krueger: syntax, format git-svn-id: file:///usr/local/Singular/svn/trunk@9424 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.9 KB
Line 
1/****************************************************************
2 *
3 *   HEADER FILE:  MP_Link.h
4 *
5 *   struct link is adapted from the Sun XDR distribution.
6 *   Copyright (C) 1984, Sun Microsystems, Inc.
7 *
8 ***************************************************************/
9
10#ifndef _MP_Link_h
11#define _MP_Link_h
12
13/* Sending modes */
14#define MP_SEND_FRAG_MSG      1
15#define MP_SEND_WHOLE_MSG     2
16#define MP_DEFAULT_SEND_MODE  MP_SEND_FRAG_MSG
17
18/* Receiving modes */
19#define MP_RECV_FRAG_MSG_RECVER   1
20#define MP_RECV_FRAG_MSG_SENDER   2
21#define MP_RECV_WHOLE_MSG         3
22#define MP_DEFAULT_RECV_MODE      MP_RECV_FRAG_MSG_RECVER
23
24/* Options that can be set for a link */
25#define MP_LINK_SEND_MODE_OPT 1
26#define MP_LINK_RECV_MODE_OPT 2
27#define MP_LINK_LOG_MASK_OPT  3
28
29#define  eor_mask ((unsigned long)(1 << 31))
30
31
32struct MP_Link_t
33{
34    int               link_id;
35    int               MP_errno;
36    MP_Env_pt         env;
37    MP_Transport_t    transp;
38    MP_BigNum_t       bignum;       /* bignum type & fncs struct  */
39    int               logmask;
40    buffer_handle_pt  i_buff;       /* ptr to list of input buff  */
41    buffer_handle_pt  o_buff;       /* ptr to list of output buff */
42    buffer_handle_pt  curr_o_buff;  /* current output buffer      */
43    buffer_handle_pt  curr_i_buff;  /* current input buffer       */
44    int               num_o_buff;   /* number of o_buff to keep with stream */
45
46    int snd_mode; /* Two possible values:
47                   * MP_SEND_FRAG_MSG - send a fragment at a time
48                   * MP_SEND_WHOLE_MSG - send a tree at a time
49                   */
50
51    int rcv_mode; /* Three possible value:
52                   * MP_RECV_FRAG_MSG_RECVER - read one sender's
53                   * fragment at a time,
54                   * MP_RECV_FRAG_MSG_SENDER - read one reciever's
55                   * fragment at a time,
56                   * MP_RECV_WHOLE_MSG - read a tree at a time.
57                   */
58    /*
59     * out-going bits
60     */
61    char   *out_base;         /* output buffer (points to frag header) */
62    char   *out_finger;       /* next output position */
63    char   *out_boundry;      /* data can go up to this address */
64    unsigned long  *o_frag_header;    /* beginning of current fragment */
65
66    /*
67     * in-coming bits
68     */
69    char   *in_base;          /* input buffer (points to frag header) */
70    char   *in_finger;        /* location of next byte to be had */
71    char   *in_boundry;       /* can read up to this location */
72    unsigned long  *i_frag_header;    /* points to fragment header */
73
74    long         fbtbc;        /* fragment bytes to be consumed */
75    long         sfblr;        /* sender's fragment bytes left to be read */
76    MP_Boolean_t last_frag;    /* tell if curr. input buff. is last of tree */
77    MP_Boolean_t s_last_frag;  /* tell if current input buffer is part of
78                                  sender's last frag. of tree */
79
80    /* the next three are inherited from the link's  environment, but
81     * are resettable and, in some cases, negotiated with the partner
82     */
83    MP_WordOrder_t    link_word_order;
84    MP_FpFormat_t     link_fp_format;
85    MP_BigNumFormat_t link_bigint_format;   /* format of SENDER! */
86    MP_BigNumFormat_t link_bigreal_format;
87};
88
89#define TEST_LINK_NULL(link) \
90   if (link == NULL) return (MP_NullLink)
91
92EXTERN MP_Link_pt MP_OpenLink _ANSI_ARGS_((MP_Env_pt env, int argc,
93                                             char **argv));
94
95EXTERN void MP_CloseLink _ANSI_ARGS_((MP_Link_pt link));
96
97EXTERN void MP_KillLink _ANSI_ARGS_((MP_Link_pt link));
98
99EXTERN MP_Status_t MP_PeekHeader _ANSI_ARGS_((MP_Link_pt link,
100                                              MP_NodeType_t *ntype,
101                                              MP_DictTag_t *dtag,
102                                              MP_Common_t *cval));
103
104EXTERN MP_Status_t MP_InitMsg _ANSI_ARGS_((MP_Link_pt link));
105
106EXTERN MP_Status_t MP_SkipMsg _ANSI_ARGS_((MP_Link_pt link));
107
108EXTERN MP_Status_t MP_EndMsg _ANSI_ARGS_((MP_Link_pt link));
109
110EXTERN MP_Status_t MP_EndMsgReset _ANSI_ARGS_((MP_Link_pt link));
111
112EXTERN MP_Boolean_t MP_TestEofMsg _ANSI_ARGS_((MP_Link_pt link));
113
114EXTERN int MP_SetLinkOption _ANSI_ARGS_((MP_Link_pt link, int option,
115                                         int value));
116
117EXTERN int MP_GetLinkOption _ANSI_ARGS_((MP_Link_pt link, int option));
118
119EXTERN MP_Boolean_t MP_GetLinkStatus _ANSI_ARGS_((MP_Link_pt link,
120                                            MP_LinkStatus_t status_to_check));
121
122EXTERN MP_Status_t IMP_GetLong _ANSI_ARGS_((MP_Link_pt link, long *lp));
123
124EXTERN MP_Status_t IMP_PutLong _ANSI_ARGS_((MP_Link_pt link, long *lp));
125
126EXTERN MP_Status_t IMP_GetBytes _ANSI_ARGS_((MP_Link_pt link, char *addr,
127                                             unsigned long len));
128
129EXTERN MP_Status_t IMP_PutBytes _ANSI_ARGS_((MP_Link_pt link, char *addr,
130                                             unsigned long len));
131
132EXTERN MP_Status_t IMP_Restore _ANSI_ARGS_((MP_Link_pt link, unsigned long n));
133#endif  /* _MP_Link_h */
Note: See TracBrowser for help on using the repository browser.