// Callback from "libICE" to process a message. private void ProcessMessage (IntPtr iceConn, IntPtr clientData, Xlib.Xint opcode, Xlib.Xulong length, XBool swap, ref IceReplyWaitInfo replyWait, ref XBool replyReadyRet) { bool haveReply; if (messageTransaction) { throw new XInvalidOperationException("Attempt to process message in the middle of sending another one"); // I always wondered, what will happen if we throw exception from callback? :) } this.messageTransaction = true; this.messageLength = (int)length; // Process the message. try { replyWait = replyWait; haveReply = true; replyReadyRet = ProcessMessage((int)opcode, replyWait.reply) ? XBool.True:XBool.False; // We omit `swap' here, can one need it? Even theoretrically?.. } catch (NullReferenceException) { haveReply = false; replyReadyRet = ProcessMessage((int)opcode) ? XBool.True:XBool.False; } this.messageTransaction = false; }
extern public static Xlib.Xint IceRegisterForProtocolReply (String protocolName, String vendor, String release, Xlib.Xint versionCount, ref IcePaVersionRec versionRecs, Xlib.Xint authCount, ref String[] authNames, ref IcePaAuthProc authProcs, IceHostBasedAuthProc hostBasedAuthProc, IceProtocolSetupProc protocolSetupProc, IceProtocolActivateProc protocolActivateProc, IceIOErrorProc ioErrorProc);
extern public static String IceComposeNetworkIdList (Xlib.Xint count, IntPtr listenObjs);
extern public static XStatus IceListenForWellKnownConnections (String port, ref Xlib.Xint countRet, ref IntPtr listenObjsRet, Xlib.Xint errorLength, byte[] errorStringRet);
extern public static IceConn *IceOpenConnection (String networkIdsList, IntPtr context, XBool mustAuthenticate, Xlib.Xint majorOpcodeCheck, Xlib.Xint errorLength, byte[] errorStringRet);
extern public static Xlib.Xint IceRegisterForProtocolSetup (String protocolName, String vendor, String release, Xlib.Xint versionCount, ref IcePoVersionRec versionRecs, Xlib.Xint authCount, String[] authNames, ref IcePoAuthProcIncapsulator authProcs, IceIOErrorProc ioErrorProc);
extern public static void _IceErrorBadLength (IceConn *iceConn, Xlib.Xint majorOpcode, Xlib.Xint offendingMinor, Xlib.Xint severity);
extern public static void _IceErrorBadValue (IceConn *iceConn, Xlib.Xint majorOpcode, Xlib.Xint offendingMinor, Xlib.Xint offset, Xlib.Xint length, IntPtr value);
extern public static Xlib.Xint _IcePaMagicCookie1Proc (IntPtr iceConn, IntPtr authStatePtr, XBool swap, Xlib.Xint authDataLen, IntPtr authData, ref Xlib.Xint replyDataLenRet, ref IntPtr replyDataRet, ref IntPtr errorStringRet);
extern public static XStatus IceProtocolShutdown (IceConn *iceConn, Xlib.Xint majorOpcode);
extern public static Xlib.Xint IceProtocolSetup (IceConn *iceConn, Xlib.Xint myOpcode, IntPtr clientData, XBool mustAuthenticate, out Xlib.Xint majorVersionRet, out Xlib.Xint minorVersionRet, out IntPtr vendorRet, out IntPtr releaseRet, Xlib.Xint errorLength, byte[] errorStringRet);
extern public static IceConn *IceAcceptConnection (IntPtr listenObj, ref Xlib.Xint statusRet);
extern public static void IceFreeListenObjs (Xlib.Xint count, IntPtr listenObjs);