dcop
ICEconn.h
Go to the documentation of this file. 00001 /* $Xorg: ICEconn.h,v 1.4 2000年08月17日 19:44:10 cpqbld Exp $ */
00002 /******************************************************************************
00003
00004
00005 Copyright 1993, 1998 The Open Group
00006
00007 All Rights Reserved.
00008
00009 The above copyright notice and this permission notice shall be included in
00010 all copies or substantial portions of the Software.
00011
00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00013 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00014 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00015 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00016 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00017 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018
00019 Except as contained in this notice, the name of The Open Group shall not be
00020 used in advertising or otherwise to promote the sale, use or other dealings
00021 in this Software without prior written authorization from The Open Group.
00022
00023 Author: Ralph Mor, X Consortium
00024 ******************************************************************************/
00025
00026 #ifndef _ICECONN_H_
00027 #define _ICECONN_H_
00028
00029 #include "KDE-ICE/ICElib.h"
00030
00031 /*
00032 * Data structures for ICE connection object
00033 */
00034
00035 typedef struct _IceSavedReplyWait {
00036 IceReplyWaitInfo *reply_wait;
00037 Bool reply_ready;
00038 struct _IceSavedReplyWait *next;
00039 } _IceSavedReplyWait;
00040
00041 typedef struct _IcePingWait {
00042 IcePingReplyProc ping_reply_proc;
00043 IcePointer client_data;
00044 struct _IcePingWait *next;
00045 } _IcePingWait;
00046
00047 typedef struct {
00048 char *vendor;
00049 char *release;
00050 int version_count;
00051 IcePoVersionRec *version_recs;
00052 int auth_count;
00053 char **auth_names;
00054 IcePoAuthProc *auth_procs;
00055 IceIOErrorProc io_error_proc;
00056 } _IcePoProtocol;
00057
00058 typedef struct {
00059 char *vendor;
00060 char *release;
00061 int version_count;
00062 IcePaVersionRec *version_recs;
00063 IceProtocolSetupProc protocol_setup_proc;
00064 IceProtocolActivateProc protocol_activate_proc;
00065 int auth_count;
00066 char **auth_names;
00067 IcePaAuthProc *auth_procs;
00068 IceHostBasedAuthProc host_based_auth_proc;
00069 IceIOErrorProc io_error_proc;
00070 } _IcePaProtocol;
00071
00072 typedef struct {
00073 char *protocol_name;
00074 _IcePoProtocol *orig_client;
00075 _IcePaProtocol *accept_client;
00076 } _IceProtocol;
00077
00078 typedef struct {
00079 Bool in_use;
00080 int my_opcode;
00081 _IceProtocol *protocol;
00082 IcePointer client_data;
00083 Bool accept_flag;
00084 union {
00085 IcePaProcessMsgProc accept_client;
00086 IcePoProcessMsgProc orig_client;
00087 } process_msg_proc;
00088 } _IceProcessMsgInfo;
00089
00090 typedef struct {
00091 int his_version_index;
00092 int my_version_index;
00093 char *his_vendor;
00094 char *his_release;
00095 char my_auth_index;
00096 IcePointer my_auth_state;
00097 Bool must_authenticate;
00098 } _IceConnectToMeInfo;
00099
00100 typedef struct {
00101 int his_opcode;
00102 int my_opcode;
00103 int his_version_index;
00104 int my_version_index;
00105 char *his_vendor;
00106 char *his_release;
00107 char my_auth_index;
00108 IcePointer my_auth_state;
00109 Bool must_authenticate;
00110 } _IceProtoSetupToMeInfo;
00111
00112 typedef struct {
00113 Bool auth_active;
00114 char my_auth_index;
00115 IcePointer my_auth_state;
00116 } _IceConnectToYouInfo;
00117
00118 typedef struct {
00119 int my_opcode;
00120 int my_auth_count;
00121 int *my_auth_indices;
00122 Bool auth_active;
00123 char my_auth_index;
00124 IcePointer my_auth_state;
00125 } _IceProtoSetupToYouInfo;
00126
00127
00128 struct _IceConn {
00129
00130 unsigned int io_ok : 1; /* did an IO error occur? */
00131 unsigned int swap : 1; /* do we need to swap on reads? */
00132 unsigned int waiting_for_byteorder : 1; /* waiting for a ByteOrder msg? */
00133 unsigned int skip_want_to_close : 1; /* avoid shutdown negotiation? */
00134 unsigned int want_to_close : 1; /* did we send a WantToClose? */
00135 unsigned int free_asap : 1; /* free as soon as possible */
00136 unsigned int unused1 : 2; /* future use */
00137 unsigned int unused2 : 8; /* future use */
00138
00139 IceConnectStatus connection_status; /* pending, accepted, rejected */
00140
00141 unsigned char my_ice_version_index; /* which version are we using? */
00142
00143 struct _XtransConnInfo *trans_conn; /* transport connection object */
00144 unsigned long send_sequence; /* Sequence # of last msg sent */
00145 unsigned long receive_sequence; /* Sequence # of last msg received */
00146
00147 char *connection_string; /* network connection string */
00148 char *vendor; /* other client's vendor */
00149 char *release; /* other client's release */
00150
00151 char *inbuf; /* Input buffer starting address */
00152 char *inbufptr; /* Input buffer index pointer */
00153 char *inbufmax; /* Input buffer maximum+1 address */
00154
00155 char *outbuf; /* Output buffer starting address */
00156 char *outbufptr; /* Output buffer index pointer */
00157 char *outbufmax; /* Output buffer maximum+1 address */
00158
00159 char *scratch; /* scratch buffer */
00160 unsigned long scratch_size; /* scratch size */
00161
00162 int dispatch_level; /* IceProcessMessages dispatch level */
00163
00164 IcePointer context; /* context associated with caller
00165 of IceOpenConnection */
00166
00167 /*
00168 * Before we read a message, the major opcode of the message must be
00169 * mapped to our corresponding major opcode (the two clients can use
00170 * different opcodes for the same protocol). In order to save space,
00171 * we keep track of the mininum and maximum major opcodes used by the
00172 * other client. To get the information on how to process this message,
00173 * we do the following...
00174 *
00175 * processMsgInfo = iceConn->process_msg_info[
00176 * message->majorOpcode - iceConn->his_min_opcode]
00177 *
00178 * Note that the number of elements in the iceConn->process_msg_info
00179 * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1).
00180 * We check process_msg_info->in_use to see if the opcode is being used.
00181 */
00182
00183 _IceProcessMsgInfo *process_msg_info;
00184 char his_min_opcode; /* [1..255] */
00185 char his_max_opcode; /* [1..255] */
00186
00187
00188 /*
00189 * Number of times this iceConn was returned in IceOpenConnection
00190 * or IceAcceptConnection.
00191 */
00192
00193 unsigned char open_ref_count;
00194
00195
00196 /*
00197 * Number of active protocols.
00198 */
00199
00200 unsigned char proto_ref_count;
00201
00202
00203 /*
00204 * If this ICE connection was created with IceAcceptConnection,
00205 * the listen_obj field is set to the listen object. Otherwise,
00206 * the listen_obj field is NULL.
00207 */
00208
00209 IceListenObj listen_obj;
00210
00211
00212
00213
00214 /*
00215 * We need to keep track of all the replies we're waiting for.
00216 * Check the comments in process.c for how this works.
00217 */
00218
00219 _IceSavedReplyWait *saved_reply_waits;
00220
00221
00222 /*
00223 * We keep track of all Pings sent from the client. When the Ping reply
00224 * arrives, we remove it from the list.
00225 */
00226
00227 _IcePingWait *ping_waits;
00228
00229
00230 /*
00231 * Some state for a client doing a Connection/Protocol Setup
00232 */
00233
00234 _IceConnectToYouInfo *connect_to_you;
00235 _IceProtoSetupToYouInfo *protosetup_to_you;
00236
00237
00238 /*
00239 * Some state for a client receiving a Connection/Protocol Setup
00240 */
00241
00242 _IceConnectToMeInfo *connect_to_me;
00243 _IceProtoSetupToMeInfo *protosetup_to_me;
00244
00245 };
00246
00247 #endif /* _ICECONN_H_ */