Example #1
0
        public Server(Ice.Communicator iceCommunicator, string clientEndpoint, Murmur.ServerPrx proxy, string name)
        {
            Users.CollectionChanged += OnUsersCollectionChanged;
            ServerProxy = proxy;
            Name = name;
            try {
                var servant = new ServerCallback(this);
                var adapter = iceCommunicator.createObjectAdapterWithEndpoints("", clientEndpoint);
                var servantProxy = adapter.addWithUUID(servant);
                ServerCallbackProxy = Murmur.ServerCallbackPrxHelper.checkedCast(servantProxy);
                adapter.activate();

                // TODO: Allow user to provide Ice secret
                var context = new Dictionary<string, string>();
                context["secret"] = "";

                ServerProxy.ice_getConnection().setAdapter(adapter);
                ServerProxy.addCallback(ServerCallbackProxy, context);
                ServerProxy.begin_getUsers().whenCompleted(
                    users => {
                        CompleteGetUsers(users);
                    },
                    e => {
                        System.Diagnostics.Debug.WriteLine("Could not get user dictionary for {0}: {1}", Name, e.ToString());
                    }
                );
            } catch (Ice.Exception e) {
                System.Diagnostics.Debug.WriteLine("Error talking to {0}: {1}", Name, e.ToString());
            }
        }
Example #2
0
 public void contextAction(string action, Murmur.User usr, int session, int channelid, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("contextAction", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             os__.writeString(action);
             if(usr == null)
             {
                 Murmur.User tmp__ = new Murmur.User();
                 tmp__.write__(os__);
             }
             else
             {
                 usr.write__(os__);
             }
             os__.writeInt(session);
             os__.writeInt(channelid);
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         if(!og__.istr().isEmpty())
         {
             try
             {
                 if(!ok__)
                 {
                     try
                     {
                         og__.throwUserException();
                     }
                     catch(Ice.UserException ex__)
                     {
                         throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                     }
                 }
                 og__.istr().skipEmptyEncaps();
             }
             catch(Ice.LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Example #3
0
 public void stopped(Murmur.ServerPrx srv, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("stopped", Ice.OperationMode.Normal, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             Murmur.ServerPrxHelper.write__(os__, srv);
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         if(!og__.istr().isEmpty())
         {
             try
             {
                 if(!ok__)
                 {
                     try
                     {
                         og__.throwUserException();
                     }
                     catch(Ice.UserException ex__)
                     {
                         throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                     }
                 }
                 og__.istr().skipEmptyEncaps();
             }
             catch(Ice.LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Example #4
0
 public static void write(IceInternal.BasicStream os__, Murmur.Tree[] v__)
 {
     if(v__ == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(v__.Length);
         for(int ix__ = 0; ix__ < v__.Length; ++ix__)
         {
             os__.writeObject(v__[ix__]);
         }
     }
 }
Example #5
0
 private void removeContextCallback(Murmur.ServerContextCallbackPrx cb, _System.Collections.Generic.Dictionary<string, string> context__, bool explicitContext__)
 {
     if(explicitContext__ && context__ == null)
     {
         context__ = emptyContext_;
     }
     int cnt__ = 0;
     while(true)
     {
         Ice.ObjectDel_ delBase__ = null;
         try
         {
             checkTwowayOnly__("removeContextCallback");
             delBase__ = getDelegate__(false);
             ServerDel_ del__ = (ServerDel_)delBase__;
             del__.removeContextCallback(cb, context__);
             return;
         }
         catch(IceInternal.LocalExceptionWrapper ex__)
         {
             handleExceptionWrapper__(delBase__, ex__, null);
         }
         catch(Ice.LocalException ex__)
         {
             handleException__(delBase__, ex__, null, ref cnt__);
         }
     }
 }
Example #6
0
 public void setState(Murmur.User state, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     setState(state, context__, true);
 }
Example #7
0
 public void setChannelState(Murmur.Channel state)
 {
     setChannelState(state, null, false);
 }
Example #8
0
 public void setBans(Murmur.Ban[] bans)
 {
     setBans(bans, null, false);
 }
Example #9
0
 public void addContextCallback(int session, string action, string text, Murmur.ServerContextCallbackPrx cb, int ctx)
 {
     addContextCallback(session, action, text, cb, ctx, null, false);
 }
Example #10
0
 public void addCallback(Murmur.ServerCallbackPrx cb)
 {
     addCallback(cb, null, false);
 }
Example #11
0
 public static void write(IceInternal.BasicStream os__, Murmur.ServerPrx[] v__)
 {
     if(v__ == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(v__.Length);
         for(int ix__ = 0; ix__ < v__.Length; ++ix__)
         {
             Murmur.ServerPrxHelper.write__(os__, v__[ix__]);
         }
     }
 }
Example #12
0
 private void contextAction(string action, Murmur.User usr, int session, int channelid, _System.Collections.Generic.Dictionary<string, string> context__, bool explicitContext__)
 {
     if(explicitContext__ && context__ == null)
     {
         context__ = emptyContext_;
     }
     int cnt__ = 0;
     while(true)
     {
         Ice.ObjectDel_ delBase__ = null;
         try
         {
             delBase__ = getDelegate__(false);
             ServerContextCallbackDel_ del__ = (ServerContextCallbackDel_)delBase__;
             del__.contextAction(action, usr, session, channelid, context__);
             return;
         }
         catch(IceInternal.LocalExceptionWrapper ex__)
         {
             handleExceptionWrapperRelaxed__(delBase__, ex__, null, ref cnt__);
         }
         catch(Ice.LocalException ex__)
         {
             handleException__(delBase__, ex__, null, ref cnt__);
         }
     }
 }
Example #13
0
 public void contextAction(string action, Murmur.User usr, int session, int channelid, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     contextAction(action, usr, session, channelid, context__, true);
 }
Example #14
0
 public void getACL(int channelid, out Murmur.ACL[] acls, out Murmur.Group[] groups, out bool inherit, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("getACL", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             os__.writeInt(channelid);
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(Murmur.InvalidChannelException)
                 {
                     throw;
                 }
                 catch(Murmur.ServerBootedException)
                 {
                     throw;
                 }
                 catch(Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream is__ = og__.istr();
             is__.startReadEncaps();
             {
                 int szx__ = is__.readSize();
                 is__.startSeq(szx__, 16);
                 acls = new Murmur.ACL[szx__];
                 for(int ix__ = 0; ix__ < szx__; ++ix__)
                 {
                     acls[ix__] = new Murmur.ACL();
                     acls[ix__].read__(is__);
                     is__.checkSeq();
                     is__.endElement();
                 }
                 is__.endSeq(szx__);
             }
             {
                 int szx__ = is__.readSize();
                 is__.startSeq(szx__, 7);
                 groups = new Murmur.Group[szx__];
                 for(int ix__ = 0; ix__ < szx__; ++ix__)
                 {
                     groups[ix__] = new Murmur.Group();
                     groups[ix__].read__(is__);
                     is__.checkSeq();
                     is__.endElement();
                 }
                 is__.endSeq(szx__);
             }
             inherit = is__.readBool();
             is__.endReadEncaps();
         }
         catch(Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Example #15
0
 public void addContextCallback(int session, string action, string text, Murmur.ServerContextCallbackPrx cb, int ctx, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     addContextCallback(session, action, text, cb, ctx, context__, true);
 }
Example #16
0
 public int Murmur_binary_hash() => Murmur.Hash(testBinary);
Example #17
0
 public void getACL(int channelid, out Murmur.ACL[] acls, out Murmur.Group[] groups, out bool inherit)
 {
     getACL(channelid, out acls, out groups, out inherit, null, false);
 }
Example #18
0
 public void setBans(Murmur.Ban[] bans, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     setBans(bans, context__, true);
 }
Example #19
0
 public void getACL(int channelid, out Murmur.ACL[] acls, out Murmur.Group[] groups, out bool inherit, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     getACL(channelid, out acls, out groups, out inherit, context__, true);
 }
Example #20
0
 public void setState(Murmur.User state)
 {
     setState(state, null, false);
 }
Example #21
0
 public void removeContextCallback(Murmur.ServerContextCallbackPrx cb)
 {
     removeContextCallback(cb, null, false);
 }
Example #22
0
 private void getACL(int channelid, out Murmur.ACL[] acls, out Murmur.Group[] groups, out bool inherit, _System.Collections.Generic.Dictionary<string, string> context__, bool explicitContext__)
 {
     if(explicitContext__ && context__ == null)
     {
         context__ = emptyContext_;
     }
     int cnt__ = 0;
     while(true)
     {
         Ice.ObjectDel_ delBase__ = null;
         try
         {
             checkTwowayOnly__("getACL");
             delBase__ = getDelegate__(false);
             ServerDel_ del__ = (ServerDel_)delBase__;
             del__.getACL(channelid, out acls, out groups, out inherit, context__);
             return;
         }
         catch(IceInternal.LocalExceptionWrapper ex__)
         {
             handleExceptionWrapperRelaxed__(delBase__, ex__, null, ref cnt__);
         }
         catch(Ice.LocalException ex__)
         {
             handleException__(delBase__, ex__, null, ref cnt__);
         }
     }
 }
Example #23
0
 public void removeContextCallback(Murmur.ServerContextCallbackPrx cb, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     removeContextCallback(cb, context__, true);
 }
Example #24
0
 private void setState(Murmur.User state, _System.Collections.Generic.Dictionary<string, string> context__, bool explicitContext__)
 {
     if(explicitContext__ && context__ == null)
     {
         context__ = emptyContext_;
     }
     int cnt__ = 0;
     while(true)
     {
         Ice.ObjectDel_ delBase__ = null;
         try
         {
             checkTwowayOnly__("setState");
             delBase__ = getDelegate__(false);
             ServerDel_ del__ = (ServerDel_)delBase__;
             del__.setState(state, context__);
             return;
         }
         catch(IceInternal.LocalExceptionWrapper ex__)
         {
             handleExceptionWrapperRelaxed__(delBase__, ex__, null, ref cnt__);
         }
         catch(Ice.LocalException ex__)
         {
             handleException__(delBase__, ex__, null, ref cnt__);
         }
     }
 }
Example #25
0
 public void setACL(int channelid, Murmur.ACL[] acls, Murmur.Group[] groups, bool inherit)
 {
     setACL(channelid, acls, groups, inherit, null, false);
 }
Example #26
0
 public static void write(IceInternal.BasicStream os__, Murmur.User[] v__)
 {
     if(v__ == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(v__.Length);
         for(int ix__ = 0; ix__ < v__.Length; ++ix__)
         {
             (v__[ix__] == null ? new Murmur.User() : v__[ix__]).write__(os__);
         }
     }
 }
Example #27
0
 public void setACL(int channelid, Murmur.ACL[] acls, Murmur.Group[] groups, bool inherit, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     setACL(channelid, acls, groups, inherit, context__, true);
 }
Example #28
0
 public void userStateChanged(Murmur.User state, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("userStateChanged", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             if(state == null)
             {
                 Murmur.User tmp__ = new Murmur.User();
                 tmp__.write__(os__);
             }
             else
             {
                 state.write__(os__);
             }
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         if(!og__.istr().isEmpty())
         {
             try
             {
                 if(!ok__)
                 {
                     try
                     {
                         og__.throwUserException();
                     }
                     catch(Ice.UserException ex__)
                     {
                         throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                     }
                 }
                 og__.istr().skipEmptyEncaps();
             }
             catch(Ice.LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Example #29
0
 public void setAuthenticator(Murmur.ServerAuthenticatorPrx auth)
 {
     setAuthenticator(auth, null, false);
 }
Example #30
0
 public void addContextCallback(int session, string action, string text, Murmur.ServerContextCallbackPrx cb, int ctx, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("addContextCallback", Ice.OperationMode.Normal, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             os__.writeInt(session);
             os__.writeString(action);
             os__.writeString(text);
             Murmur.ServerContextCallbackPrxHelper.write__(os__, cb);
             os__.writeInt(ctx);
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(Murmur.InvalidCallbackException)
                 {
                     throw;
                 }
                 catch(Murmur.ServerBootedException)
                 {
                     throw;
                 }
                 catch(Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             og__.istr().skipEmptyEncaps();
         }
         catch(Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Example #31
0
 public void setAuthenticator(Murmur.ServerAuthenticatorPrx auth, _System.Collections.Generic.Dictionary<string, string> context__)
 {
     setAuthenticator(auth, context__, true);
 }
Example #32
0
 public uint GetNameHash()
 {
     return(Murmur.Hash2(Name));
 }
Example #33
0
 public int Murmur_string_hash() => Murmur.Hash(testString);