Return to AHTBridge.c CVS log | Up to [Public] / Amaya / amaya |
1.9 cvs 1: /* 2: * 3: * (c) COPYRIGHT MIT and INRIA, 1996. 4: * Please first read the full copyright statement in file COPYRIGHT. 5: * 6: */ 7: 1.14 cvs 8: /* 9: * AHTBridge.c : This module implements the callback setup and 10: * handlers between the Xt, libwww, and Amaya procedures. It's responsible 11: * for assigning, modifying, and supressing Xt events to the active 12: * requests. 13: * 14: * Author: J Kahan 1.28 cvs 15: * R. Guetari/J. Kahan Windows NT/95 routines 1.14 cvs 16: * 17: */ 1.23 cvs 18: #ifndef AMAYA_JAVA 19: 1.16 cvs 20: #define THOT_EXPORT extern 1.4 cvs 21: #include "amaya.h" 1.10 cvs 22: #include "AHTBridge_f.h" 23: #include "AHTFWrite_f.h" 24: #include "query_f.h" 25: #include "answer_f.h" 1.4 cvs 26: 1.22 cvs 27: #ifndef _WINDOWS 1.4 cvs 28: /* Amaya's X appcontext */ 1.16 cvs 29: extern ThotAppContext app_cont; 1.4 cvs 30: 1.32 cvs 31: /* Private functions */ 1.4 cvs 32: #ifdef __STDC__ 1.18 cvs 33: static void RequestRegisterReadXtevent (AHTReqContext *, SOCKET); 1.7 cvs 34: static void RequestKillReadXtevent (AHTReqContext *); 1.18 cvs 35: static void RequestRegisterWriteXtevent (AHTReqContext *, SOCKET); 1.7 cvs 36: static void RequestKillWriteXtevent (AHTReqContext *); 1.18 cvs 37: static void RequestRegisterExceptXtevent (AHTReqContext *, SOCKET); 1.7 cvs 38: static void RequestKillExceptXtevent (AHTReqContext *); 1.27 cvs 39: #else /* __STDC__ */ 1.18 cvs 40: static void RequesAddReadXtevent (); 1.7 cvs 41: static void RequestKillReadXtevent (); 1.18 cvs 42: static void RequesAddWriteXtevent (); 1.7 cvs 43: static void RequestKillWriteXtevent (); 1.18 cvs 44: static void RequestRegisterExceptXtevent (); 1.7 cvs 45: static void RequestKillExceptXtevent (); 1.27 cvs 46: #endif /* __STDC__ */ 1.24 cvs 47: #endif /* _WINDOWS */ 48: 1.32 cvs 49: /* Private variables */ 1.4 cvs 50: 51: /* 52: * this set of SockOps map our WinSock "socket event SockOps" into 53: * our read and write sets. Note that under the canonical Unix model, 54: * a non-blocking socket passed to an accept() call will appear as readable, 55: * whilst a non-blocking call to connect() will appear as writeable. In add. 56: * if the connection has been closed, the socket will appear readable under 57: * BSD Unix semantics 58: */ 1.32 cvs 59: 1.10 cvs 60: static const SockOps ReadBits = FD_READ | FD_ACCEPT | FD_CLOSE; 61: static const SockOps WriteBits = FD_WRITE | FD_CONNECT; 62: static const SockOps ExceptBits = FD_OOB; 1.4 cvs 63: 1.32 cvs 64: /* Private functions */ 1.4 cvs 65: 1.10 cvs 66: /*-------------------------------------------------------------------- 67: AHTCallback_bridge 1.11 cvs 68: this function acts as a bridge between Xt and libwww. From the Xt 69: point of view, this function is the callback handler whenever there's 70: any activity on the sockets associated with the active requests. From 71: the libwww point of view, this is the function that takes the initiative 72: to invoke the callback function associated with an active request, 73: whenever there's an activity in the socket associated to it. 74: In this latter aspect, this function is similar to the library's 75: own __DoCallback() function. 76: Upon activation, the function looks up the request associated with the 77: active socket and then looks up the cbf associated with that request. 78: Upon completion of the execution of the request's cbf, it verifies 79: the state of the request and, if it's an asynchronous request, deletes 80: the memory allocated to it. 1.10 cvs 81: -------------------------------------------------------------------*/ 1.24 cvs 82: #ifdef _WINDOWS 1.26 cvs 83: #ifdef __STDC__ 84: static void* WIN_AHTCallback_bridge (SockOps _ops, int *s) 85: #else /* __STDC__ */ 86: static void* WIN_AHTCallback_bridge (_ops, s) 87: SockOps _ops; 88: int* s; 89: #endif /* __STDC__ */ 90: #else /* _WINDOWS */ 1.4 cvs 91: #ifdef __STDC__ 1.12 cvs 92: void *AHTCallback_bridge (caddr_t cd, int *s, XtInputId * id) 1.26 cvs 93: #else /* __STDC__ */ 1.12 cvs 94: void *AHTCallback_bridge (cd, s, id) 1.7 cvs 95: caddr_t cd; 96: int *s; 97: XtInputId *id; 1.4 cvs 98: #endif /* __STDC__ */ 1.24 cvs 99: #endif /* _WINDOWS */ 1.4 cvs 100: { 1.11 cvs 101: int status; /* the status result of the libwwww call */ 1.7 cvs 102: HTRequest *rqp = NULL; 103: AHTReqContext *me; 1.11 cvs 104: SockOps ops; 1.4 cvs 105: 1.10 cvs 106: /* Libwww 5.0a does not take into account the ops parameter 1.11 cvs 107: in the invocation of for this function call */ 1.4 cvs 108: 1.32 cvs 109: # ifdef HACK_WWW 1.7 cvs 110: HTEventCallback *cbf; 1.32 cvs 111: # else 1.13 cvs 112: HTEventCallback *cbf; 1.7 cvs 113: 1.13 cvs 114: ops = FD_WRITE; 115: cbf = (HTEventCallback *) __RetrieveCBF (*s, ops, &rqp); 1.32 cvs 116: # endif 1.13 cvs 117: 1.7 cvs 118: me = HTRequest_context (rqp); 119: if (THD_TRACE) 1.32 cvs 120: fprintf (stderr, "AHTBridge: Processing url %s \n", me->urlName); 1.4 cvs 121: 1.17 cvs 122: /* verify if there's any callback associated with the request */ 1.32 cvs 123: if (!cbf || !rqp || rqp->priority == HT_PRIORITY_OFF) { 124: if (THD_TRACE) 125: HTTrace ("Callback.... No callback found\n"); 126: 127: /* experimental */ 128: /* remove the Xt input which caused this callback */ 129: # ifdef WWW_XWINDOWS 130: XtRemoveInput (*id); 131: # endif 132: /* put some more code to correctly destroy this request ?*/ 133: return (0); 134: } 1.4 cvs 135: 1.26 cvs 136: # ifdef _WINDOWS 1.24 cvs 137: ops = _ops; 1.26 cvs 138: # else 1.32 cvs 139: switch ((XtInputId) cd) { 140: case XtInputReadMask: 1.19 cvs 141: ops = me->read_ops; 142: ops = FD_READ; 143: break; 1.32 cvs 144: case XtInputWriteMask: 1.7 cvs 145: ops = me->write_ops; 146: ops = FD_WRITE; 147: break; 1.32 cvs 148: case XtInputExceptMask: 1.7 cvs 149: ops = me->except_ops; 150: ops = FD_OOB; 151: break; 1.32 cvs 152: default: 153: break; 154: } /* switch */ 1.26 cvs 155: # endif /* _WINDOWS */ 1.17 cvs 156: 1.32 cvs 157: /* Invokes the callback associated to the requests */ 158: 159: /* first we change the status of the request, to say it 160: has entered a critical section */ 161: 162: if ((HTRequest_outputStream(me->request) == (HTStream *) NULL)) 163: fprintf(stderr,"\n **ERROR** opening %s\n\n",me->urlName); 164: 165: me->reqStatus = HT_BUSY; 166: if ((status = (*cbf) (*s, rqp, ops)) != HT_OK) 167: HTTrace ("Callback.... received != HT_OK"); 1.4 cvs 168: 1.7 cvs 169: /* Several states can happen after this callback. They 170: * are indicated by the me->reqStatus structure member and 171: * the fds external variables. The following lines examine 172: * the states and correspondly update the Xt event register 173: * 174: * Regarding the me->reqStatus member, we have the following 175: * possible states: 176: * 177: * HT_BUSY: Request has blocked 178: * HT_WAITING: Request has been reissued 179: * HT_ABORT: Request has been stopped 180: * HT_END: Request has ended 181: */ 182: 1.32 cvs 183: if (me->reqStatus == HT_ABORT) { 1.11 cvs 184: /* Has the user stopped the request? */ 1.32 cvs 185: me->reqStatus = HT_WAITING; 186: StopRequest (me->docid); 187: return (0); 188: } 1.7 cvs 189: 1.32 cvs 190: if (me->reqStatus == HT_WAITING) { 191: /* the request is being reissued */ 192: /* 193: * (1) The old request has ended and the library 194: * assigned the old socket number to a pending 195: * request. 196: * 197: * (2) The request has been reissued after an 198: * authentication or redirection directive and 199: * we are using the same old socket number. 200: */ 1.11 cvs 201: 202: if (THD_TRACE) 1.32 cvs 203: fprintf (stderr, "*** detected a reissue of request \n"); 1.11 cvs 204: return (0); 1.32 cvs 205: } 1.4 cvs 206: 1.32 cvs 207: /* we verify if the request exists. If it has ended, we will have 208: a reqStatus with an HT_END value */ 1.7 cvs 209: 1.32 cvs 210: if ((me->request->net == (HTNet *) NULL) || (me->reqStatus == HT_END || me->reqStatus == HT_ERR)) { 211: /* request has ended */ 212: # ifndef _WINDOWS 213: if (THD_TRACE) 214: fprintf (stderr, "(BF) removing Xtinput %lu !RWE, sock %d (Request has ended)\n", *id, *s); 1.33 ! cvs 215: # endif /* !_WINDOWS */ 1.32 cvs 216: if ((me->mode & AMAYA_ASYNC) || (me->mode & AMAYA_IASYNC)) { 217: /* free the memory allocated for async requests */ 218: AHTPrintPendingRequestStatus (me->docid, YES); 219: AHTReqContext_delete (me); 220: } else if (me->reqStatus != HT_END && HTError_hasSeverity (HTRequest_error (me->request), ERR_NON_FATAL)) 221: /* did the SYNC request end because of an error? If yes, report it back to the caller */ 222: me->reqStatus = HT_ERR; 223: return (0); 224: } 1.11 cvs 225: 226: /* The request is still alive, so change it's status to indicate it's out of the 227: critical section */ 1.7 cvs 228: me->reqStatus = HT_WAITING; 229: return (0); 1.4 cvs 230: } 231: 1.32 cvs 232: #ifdef _WINDOWS 1.29 cvs 233: /*---------------------------------------------------------------- 1.32 cvs 234: WIN_Activate_Request 1.29 cvs 235: when there are more open requests than available sockets, the 236: requests are put in a "pending state." When a socket becomes 237: available, libwww associates it with a pending request and then 238: calls this callback function. This function is responsible for 239: opening the temporary file where the GET and POST results 240: will be stored. The function is also responsible for 241: registering the socket with the Xt event loop. 242: Consult the libwww manual for more details on the signature 243: of this function. 244: ----------------------------------------------------------------*/ 245: #ifdef __STDC__ 1.32 cvs 246: int WIN_Activate_Request (HTRequest * request, HTAlertOpcode op, int msgnum, const char *dfault, void *input, HTAlertPar * reply) 1.29 cvs 247: #else 1.32 cvs 248: int WIN_Activate_Request (request, op, msgnum, dfault, input, reply) 1.29 cvs 249: HTRequest *request; 250: HTAlertOpcode op; 251: int msgnum; 252: const char *dfault; 253: void *input; 254: HTAlertPar *reply; 255: 256: #endif /* __STDC__ */ 257: { 258: AHTReqContext *me = HTRequest_context (request); 259: 1.32 cvs 260: if (me->reqStatus == HT_NEW) { 1.33 ! cvs 261: if ((me->output != stdout) && me->outputfile && (me->output = fopen (me->outputfile, "wb")) == NULL) { 1.29 cvs 262: /* the request is associated with a file */ 1.32 cvs 263: me->outputfile[0] = EOS; /* file could not be opened */ 1.29 cvs 264: TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_CREATE_FILE), 265: me->outputfile); 266: me->reqStatus = HT_ERR; 1.32 cvs 267: if (me->error_html) 268: DocNetworkStatus[me->docid] |= AMAYA_NET_ERROR; /* so we can show the error message */ 269: } else { 270: if (THD_TRACE) 271: fprintf (stderr, "Add_NewSocket_to_Loop: Activating pending %s . Open fd %d\n", me->urlName, (int) me->output); 272: HTRequest_setOutputStream (me->request, AHTFWriter_new (me->request, me->output, YES)); 273: /*change the status of the request */ 274: me->reqStatus = HT_WAITING; 275: } 276: } 277: else if (me->reqStatus == HT_WAITING) { 278: 279: /*change the status of the request */ 280: rewind (me->output); 281: if (HTRequest_outputStream (me->request) == NULL) 282: HTRequest_setOutputStream (me->request, AHTFWriter_new (me->request, me->output, YES)); 283: } 284: else { 285: me->reqStatus = HT_ERR; 286: } 287: 288: return ((me->reqStatus != HT_ERR) ? HT_OK : HT_ERROR); 289: } 290: 291: #else 292: 293: /*---------------------------------------------------------------- 294: Add_NewSocket_to_Loop 295: when there are more open requests than available sockets, the 296: requests are put in a "pending state." When a socket becomes 297: available, libwww associates it with a pending request and then 298: calls this callback function. This function is responsible for 299: opening the temporary file where the GET and POST results 300: will be stored. The function is also responsible for 301: registering the socket with the Xt event loop. 302: Consult the libwww manual for more details on the signature 303: of this function. 304: ----------------------------------------------------------------*/ 305: #ifdef __STDC__ 306: int Add_NewSocket_to_Loop (HTRequest * request, HTAlertOpcode op, int msgnum, const char *dfault, void *input, HTAlertPar * reply) 307: #else 308: int Add_NewSocket_to_Loop (request, op, msgnum, dfault, input, reply) 309: HTRequest *request; 310: HTAlertOpcode op; 311: int msgnum; 312: const char *dfault; 313: void *input; 314: HTAlertPar *reply; 1.29 cvs 315: 1.32 cvs 316: #endif /* __STDC__ */ 317: { 318: AHTReqContext *me = HTRequest_context (request); 1.4 cvs 319: 1.30 cvs 320: if (THD_TRACE) 1.32 cvs 321: fprintf (stderr, "(Activating a request\n"); 1.30 cvs 322: 1.32 cvs 323: if (me->reqStatus == HT_NEW || me->reqStatus == HT_PENDING) { 324: /* the request is active, open the output file */ 1.33 ! cvs 325: if ((me->output != stdout) && !(me->output = fopen (me->outputfile, "w"))) { 1.32 cvs 326: me->outputfile[0] = EOS; 327: /* file could not be opened */ 328: TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_CREATE_FILE), me->outputfile); 329: me->reqStatus = HT_ERR; 330: /* should the error be shown on the Amaya doc window? */ 331: if (me->error_html) 332: DocNetworkStatus[me->docid] |= AMAYA_NET_ERROR; 333: } 334: /* else { 335: HTRequest_setOutputStream (me->request, AHTFWriter_new (me->request, me->output, YES)); 336: me->reqStatus = HT_WAITING; 337: }*/ 338: #ifdef JOSE 339: fprintf (stderr, "ADDNEWSOCK: associated %s to fd %d\n", me->urlName, me->output); 340: #endif 341: if (me->output) { 342: if (THD_TRACE) 343: fprintf (stderr, "Add_NewSocket_to_Loop: Activating pending %s . Open fd %d\n", me->urlName, (int) me->output); 344: HTRequest_setOutputStream (me->request, AHTFWriter_new (me->request, me->output, YES)); 345: me->reqStatus = HT_WAITING; 346: } 347: } 348: else if (me->reqStatus == HT_BUSY) { 349: /* JK: Comment: see if we can add HT_WAIT HERE */ 350: /* request was aborted and now is is being reissued */ 351: rewind (me->output); 352: /* verify if this is OK */ 353: HTRequest_setOutputStream (me->request, AHTFWriter_new (me->request, me->output, YES)); 354: } 355: 1.7 cvs 356: return (HT_OK); 1.4 cvs 357: } 1.32 cvs 358: #endif /* _WINDOWS */ 1.4 cvs 359: 1.11 cvs 360: /*---------------------------------------------------------------------- 361: AHTEvent_register 362: callback called by libwww whenever a socket is open and associated 363: to a request. It sets the pertinent Xt events so that the Xt Event 364: loops gets an interruption whenever there's action of the socket. 365: In addition, it registers the request with libwww. 366: ----------------------------------------------------------------------*/ 1.4 cvs 367: #ifdef __STDC__ 1.7 cvs 368: int AHTEvent_register (SOCKET sock, HTRequest * rqp, SockOps ops, HTEventCallback * cbf, HTPriority p) 1.4 cvs 369: #else 1.7 cvs 370: int AHTEvent_register (sock, rqp, ops, cbf, p) 371: SOCKET sock; 372: HTRequest *rqp; 373: SockOps ops; 374: HTEventCallback *cbf; 375: HTPriority p; 376: 377: #endif /* __STDC__ */ 1.4 cvs 378: { 1.11 cvs 379: AHTReqContext *me; /* current request */ 380: int status; /* libwww status associated with the socket number */ 1.7 cvs 381: 1.33 ! cvs 382: /* verify this under UNIX */ 1.7 cvs 383: if (sock == INVSOC) 1.4 cvs 384: return (0); 385: 1.7 cvs 386: /* get the request associated to the socket number */ 387: 388: if ((status = HTEventrg_register (sock, rqp, ops, 389: cbf, p)) != HT_OK) 1.4 cvs 390: return (status); 391: 1.7 cvs 392: if (rqp) 393: { 394: me = HTRequest_context (rqp); 1.4 cvs 395: 1.7 cvs 396: /* verify if we need to open the fd */ 1.32 cvs 397: if (me->reqStatus == HT_NEW) 1.7 cvs 398: { 399: /* we are opening a pending request */ 1.33 ! cvs 400: if ((me->output != stdout) && (me->output = fopen (me->outputfile, "w")) == NULL) 1.7 cvs 401: { 402: me->outputfile[0] = '\0'; /* file could not be opened */ 403: TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_CREATE_FILE), 404: me->outputfile); 405: me->reqStatus = HT_ERR; 406: return (HT_ERROR); 407: } 1.32 cvs 408: #ifdef JOSE 409: fprintf (stderr, "ADDNEWSOCK: associated %s to fd %d\n", me->urlName, me->output); 410: #endif 1.7 cvs 411: HTRequest_setOutputStream (me->request, 412: AHTFWriter_new (me->request, me->output, YES)); 413: me->reqStatus = HT_WAITING; 414: 415: if (THD_TRACE) 416: fprintf (stderr, "AHTEvent_register: Activating pending request url %s, fd %d\n", me->urlName, (int) me->output); 417: } 1.4 cvs 418: 1.7 cvs 419: if (THD_TRACE) 420: fprintf (stderr, "AHTEvent_register: url %s, sock %d, ops %lu \n", 421: me->urlName, sock, ops); 1.4 cvs 422: 1.33 ! cvs 423: #ifndef _WINDOWS 1.7 cvs 424: if (ops & ReadBits) 425: { 426: me->read_ops = ops; 1.18 cvs 427: RequestRegisterReadXtevent (me, sock); 1.7 cvs 428: } 429: 430: if (ops & WriteBits) 431: { 432: me->write_ops = ops; 1.18 cvs 433: RequestRegisterWriteXtevent (me, sock); 1.7 cvs 434: } 435: 436: if (ops & ExceptBits) 437: { 438: me->except_ops = ops; 1.18 cvs 439: RequestRegisterExceptXtevent (me, sock); 1.7 cvs 440: } 1.33 ! cvs 441: #endif /* !_WINDOWS */ ! 442: } 1.7 cvs 443: return (status); 1.4 cvs 444: } 1.33 ! cvs 445: ! 446: #ifndef _WINDOWS 1.4 cvs 447: 1.11 cvs 448: /*---------------------------------------------------------------------- 449: AHTEvent_unregister 450: callback called by libwww each time a request is unregistered. This 451: function takes care of unregistering the pertinent Xt events 452: associated with the request's socket. In addition, it unregisters 453: the request from libwww. 454: ----------------------------------------------------------------------*/ 1.4 cvs 455: #ifdef __STDC__ 1.7 cvs 456: int AHTEvent_unregister (SOCKET sock, SockOps ops) 1.4 cvs 457: #else 1.7 cvs 458: int AHTEvent_unregister (sock, ops) 459: SOCKET sock; 460: SockOps ops; 461: 462: #endif /* __STDC__ */ 1.4 cvs 463: { 1.7 cvs 464: int status; 465: 466: HTRequest *rqp = NULL; 467: AHTReqContext *me; 1.4 cvs 468: 1.11 cvs 469: /* Libwww 5.0a does not take into account the third parameter 1.7 cvs 470: ** for this function call */ 1.4 cvs 471: 1.7 cvs 472: HTEventCallback *cbf = (HTEventCallback *) __RetrieveCBF (sock, (SockOps) NULL, &rqp); 1.4 cvs 473: 1.7 cvs 474: if (cbf) 475: { 476: if (rqp) 477: { 478: me = HTRequest_context (rqp); 479: 480: if (ops & ReadBits) 481: RequestKillReadXtevent (me); 1.4 cvs 482: 1.7 cvs 483: if (ops & WriteBits) 484: RequestKillWriteXtevent (me); 485: 486: if (ops & ExceptBits) 487: RequestKillExceptXtevent (me); 488: } 489: } 490: 491: status = HTEventrg_unregister (sock, ops); 492: return (status); 1.4 cvs 493: } 494: 1.11 cvs 495: /*---------------------------------------------------------------------- 496: RequestKillAllXtevents 497: front-end for kill all Xt events associated with the request pointed 498: to by "me". 499: ----------------------------------------------------------------------*/ 1.4 cvs 500: #ifdef __STDC__ 1.7 cvs 501: void RequestKillAllXtevents (AHTReqContext * me) 1.4 cvs 502: #else 1.7 cvs 503: void RequestKillAllXtevents (me) 504: AHTReqContext *me; 505: #endif /* __STDC__ */ 1.4 cvs 506: { 1.7 cvs 507: if (THD_TRACE) 508: fprintf (stderr, "Request_kill: Clearing Xtinputs\n"); 1.4 cvs 509: 1.7 cvs 510: RequestKillReadXtevent (me); 511: RequestKillWriteXtevent (me); 512: RequestKillExceptXtevent (me); 1.4 cvs 513: } 514: 1.11 cvs 515: /*---------------------------------------------------------------------- 1.18 cvs 516: RequestRegisterReadXtevent 517: Registers with Xt the read events associated with socket sock 518: ----------------------------------------------------------------------*/ 519: #ifdef __STDC__ 520: static void RequestRegisterReadXtevent (AHTReqContext * me, SOCKET sock) 521: #else 522: static void RequestRegisterReadXtevent (me, sock) 523: AHTReqContext *me; 524: SOCKET sock; 525: #endif /* __STDC__ */ 526: { 527: if (me->read_xtinput_id) 528: { 529: if (THD_TRACE) 530: fprintf (stderr, "Request_kill: Clearing Xtinput %lu Socket %d R\n", me->read_xtinput_id, sock); 531: XtRemoveInput (me->read_xtinput_id); 532: } 533: 534: me->read_xtinput_id = 535: XtAppAddInput (app_cont, 536: sock, 537: (XtPointer) XtInputReadMask, 538: (XtInputCallbackProc) AHTCallback_bridge, 539: (XtPointer) XtInputReadMask); 540: 1.26 cvs 541: if (THD_TRACE) 1.18 cvs 542: fprintf (stderr, "(BT) adding Xtinput %lu Socket %d R\n", 543: me->read_xtinput_id, sock); 544: 545: } 546: 547: /*---------------------------------------------------------------------- 1.11 cvs 548: RequestKillReadXtevent 549: kills any read Xt event associated with the request pointed to by "me". 550: ----------------------------------------------------------------------*/ 1.4 cvs 551: #ifdef __STDC__ 1.7 cvs 552: static void RequestKillReadXtevent (AHTReqContext * me) 1.4 cvs 553: #else 1.7 cvs 554: static void RequestKillReadXtevent (me) 555: AHTReqContext *me; 556: #endif /* __STDC__ */ 1.4 cvs 557: { 1.7 cvs 558: if (me->read_xtinput_id) 559: { 560: if (THD_TRACE) 1.18 cvs 561: fprintf (stderr, "Request_kill: Clearing Xtinput %lu R\n", me->read_xtinput_id); 1.7 cvs 562: XtRemoveInput (me->read_xtinput_id); 563: me->read_xtinput_id = (XtInputId) NULL; 564: } 1.18 cvs 565: } 566: 567: /*---------------------------------------------------------------------- 568: RequestRegisterWriteXtevent 569: Registers with Xt the write events associated with socket sock 570: ----------------------------------------------------------------------*/ 571: #ifdef __STDC__ 572: static void RequestRegisterWriteXtevent (AHTReqContext * me, SOCKET sock) 573: #else 574: static void RequestRegisterWriteXtevent (me, sock) 575: AHTReqContext *me; 576: SOCKET sock; 577: 578: #endif /* __STDC__ */ 579: { 580: if (me->write_xtinput_id) 581: { 582: if (THD_TRACE) 583: fprintf (stderr, "Request_kill: Clearing Xtinput %lu Socket %d W\n", me->write_xtinput_id, sock); 584: XtRemoveInput (me->write_xtinput_id); 585: } 586: 587: me->write_xtinput_id = 588: XtAppAddInput (app_cont, 589: sock, 590: (XtPointer) XtInputWriteMask, 591: (XtInputCallbackProc) AHTCallback_bridge, 592: (XtPointer) XtInputWriteMask); 593: 594: if (THD_TRACE) 595: fprintf (stderr, "(BT) adding Xtinput %lu Socket %d W\n", 596: me->write_xtinput_id, sock); 1.4 cvs 597: } 598: 1.11 cvs 599: /*---------------------------------------------------------------------- 600: RequestKillWriteXtevent 601: kills any write Xt event associated with the request pointed to 602: by "me". 603: ----------------------------------------------------------------------*/ 1.4 cvs 604: #ifdef __STDC__ 1.7 cvs 605: static void RequestKillWriteXtevent (AHTReqContext * me) 1.4 cvs 606: #else 1.7 cvs 607: static void RequestKillWriteXtevent (me) 608: AHTReqContext *me; 609: #endif /* __STDC__ */ 1.4 cvs 610: { 1.7 cvs 611: if (me->write_xtinput_id) 612: { 613: if (THD_TRACE) 614: fprintf (stderr, "Request_kill: Clearing Write Xtinputs %lu\n", me->write_xtinput_id); 615: XtRemoveInput (me->write_xtinput_id); 616: me->write_xtinput_id = (XtInputId) NULL; 617: } 1.18 cvs 618: } 619: 620: /*---------------------------------------------------------------------- 621: RequestRegisterExceptXtevent 622: Registers with Xt the except events associated with socket sock 623: ----------------------------------------------------------------------*/ 624: #ifdef __STDC__ 625: static void RequestRegisterExceptXtevent (AHTReqContext * me, SOCKET sock) 626: #else 627: static void RequestRegisterExceptXtevent (me, sock) 628: AHTReqContext *me; 629: SOCKET sock; 630: 631: #endif /* __STDC__ */ 632: { 633: if (me->except_xtinput_id) 634: { 635: if (THD_TRACE) 636: fprintf (stderr, "Request_kill: Clearing Xtinput %lu Socket %d E\n", me->except_xtinput_id, sock); 637: XtRemoveInput (me->except_xtinput_id); 638: } 639: 640: me->except_xtinput_id = 641: XtAppAddInput (app_cont, 642: sock, 643: (XtPointer) XtInputExceptMask, 644: (XtInputCallbackProc) AHTCallback_bridge, 645: (XtPointer) XtInputExceptMask); 646: 647: if (THD_TRACE) 648: fprintf (stderr, "(BT) adding Xtinput %lu Socket %d E\n", 649: me->write_xtinput_id, sock); 650: 1.4 cvs 651: } 652: 1.11 cvs 653: /*---------------------------------------------------------------------- 654: RequestKillExceptXtevent 655: kills any exception Xt event associated with the request pointed to 656: by "me". 657: ----------------------------------------------------------------------*/ 1.4 cvs 658: #ifdef __STDC__ 1.7 cvs 659: static void RequestKillExceptXtevent (AHTReqContext * me) 1.4 cvs 660: #else 1.7 cvs 661: static void RequestKillExceptXtevent (me) 662: AHTReqContext *me; 663: #endif /* __STDC__ */ 1.4 cvs 664: { 1.7 cvs 665: if (me->except_xtinput_id) 666: { 667: if (THD_TRACE) 668: fprintf (stderr, "Request_kill: Clearing Except Xtinputs %lu\n", me->except_xtinput_id); 669: XtRemoveInput (me->except_xtinput_id); 670: me->except_xtinput_id = (XtInputId) NULL; 671: } 1.31 cvs 672: } 1.32 cvs 673: #endif /* !_WINDOWS */ 1.31 cvs 674: 1.23 cvs 675: #endif /* !AMAYA_JAVA */ 1.11 cvs 676: 677: 678: 679: