diff options
Diffstat (limited to 'src/sm_manager.c')
-rw-r--r-- | src/sm_manager.c | 129 |
1 files changed, 63 insertions, 66 deletions
diff --git a/src/sm_manager.c b/src/sm_manager.c index 2c49c65..23e83cb 100644 --- a/src/sm_manager.c +++ b/src/sm_manager.c @@ -32,79 +32,22 @@ in this Software without prior written authorization from The Open Group. #include <X11/SM/SMlib.h> #include "SMlibint.h" +#include <X11/Xtrans.h> #ifdef __USLC__ #undef shutdown #endif -Status -SmsInitialize (vendor, release, newClientProc, managerData, - hostBasedAuthProc, errorLength, errorStringRet) - -char *vendor; -char *release; -SmsNewClientProc newClientProc; -SmPointer managerData; -IceHostBasedAuthProc hostBasedAuthProc; -int errorLength; -char *errorStringRet; - -{ - if (errorStringRet && errorLength > 0) - *errorStringRet = '\0'; - - if (!newClientProc) - { - strncpy (errorStringRet, - "The SmsNewClientProc callback can't be NULL", errorLength); - - return (0); - } - - if (!_SmsOpcode) - { - Status _SmsProtocolSetupProc (); - - if ((_SmsOpcode = IceRegisterForProtocolReply ("XSMP", - vendor, release, _SmVersionCount, _SmsVersions, - _SmAuthCount, _SmAuthNames, _SmsAuthProcs, hostBasedAuthProc, - _SmsProtocolSetupProc, - NULL, /* IceProtocolActivateProc - we don't care about - when the Protocol Reply is sent, because the - session manager can not immediately send a - message - it must wait for RegisterClient. */ - NULL /* IceIOErrorProc */ - )) < 0) - { - strncpy (errorStringRet, - "Could not register XSMP protocol with ICE", errorLength); - - return (0); - } - } - - _SmsNewClientProc = newClientProc; - _SmsNewClientData = managerData; - - return (1); -} - - - -Status -_SmsProtocolSetupProc (iceConn, - majorVersion, minorVersion, vendor, release, - clientDataRet, failureReasonRet) - -IceConn iceConn; -int majorVersion; -int minorVersion; -char *vendor; -char *release; -IcePointer *clientDataRet; -char **failureReasonRet; +static Status +_SmsProtocolSetupProc (IceConn iceConn, + int majorVersion, + int minorVersion, + char *vendor, + char *release, + IcePointer *clientDataRet, + char **failureReasonRet) { SmsConn smsConn; unsigned long mask; @@ -165,6 +108,60 @@ char **failureReasonRet; + +Status +SmsInitialize (vendor, release, newClientProc, managerData, + hostBasedAuthProc, errorLength, errorStringRet) + +char *vendor; +char *release; +SmsNewClientProc newClientProc; +SmPointer managerData; +IceHostBasedAuthProc hostBasedAuthProc; +int errorLength; +char *errorStringRet; + +{ + if (errorStringRet && errorLength > 0) + *errorStringRet = '\0'; + + if (!newClientProc) + { + strncpy (errorStringRet, + "The SmsNewClientProc callback can't be NULL", errorLength); + + return (0); + } + + if (!_SmsOpcode) + { + + if ((_SmsOpcode = IceRegisterForProtocolReply ("XSMP", + vendor, release, _SmVersionCount, _SmsVersions, + _SmAuthCount, _SmAuthNames, _SmsAuthProcs, hostBasedAuthProc, + _SmsProtocolSetupProc, + NULL, /* IceProtocolActivateProc - we don't care about + when the Protocol Reply is sent, because the + session manager can not immediately send a + message - it must wait for RegisterClient. */ + NULL /* IceIOErrorProc */ + )) < 0) + { + strncpy (errorStringRet, + "Could not register XSMP protocol with ICE", errorLength); + + return (0); + } + } + + _SmsNewClientProc = newClientProc; + _SmsNewClientData = managerData; + + return (1); +} + + + /* Using private API from libICE. */ extern char *_IceGetPeerName (IceConn /* iceConn */); |