Beispiel #1
0
        private int Send_Hook(IntPtr pConnection, uint unk, int len, byte[] buf)
        {
            try
            {
                if (_pluginProxy != null)
                {
                    _pluginProxy.SentPacket(buf);
                }
            }
            catch (Exception) { }

            return(Connection_t.Send(pConnection, unk, len, buf));
        }
Beispiel #2
0
        public static unsafe void Send(byte[] payload)
        {
            IntPtr pClient = Client_t.GetInstanceIfAny();

            if (pClient == IntPtr.Zero)
            {
                return;
            }

            IntPtr pConnection = *(IntPtr *)(pClient + 0x84);

            if (pConnection == IntPtr.Zero)
            {
                return;
            }

            Connection_t.Send(pConnection, 0, payload.Length, payload);
        }
        private ConnectionList_t ReadConnList(IStructReader reader)
        {
            try
            {
                logger.Info("CSTAConferenceCallConfParser.ReadConnList: BaseStream.Position={0};BaseStream.Length={1};", reader.BaseStream.Position, reader.BaseStream.Length);

                if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 4)
                {
                    logger.Info("CSTAConferenceCallConfParser.ReadConnList: read count of transferred connections...");

                    uint count = reader.ReadUInt32();

                    logger.Info("CSTAConferenceCallConfParser.ReadConnList: count={0}", count);

                    List <Connection_t> connections = new List <Connection_t>();

                    if (count > 0)
                    {
                        if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 12)
                        {
                            logger.Info("CSTAConferenceCallConfParser.ReadConnList: advance the base stream 12 positions...");
                            reader.BaseStream.Position += 12;
                        }

                        int size = Marshal.SizeOf(typeof(Connection_t));

                        for (int i = 0; i < count; i++)
                        {
                            logger.Info("CSTAConferenceCallConfParser.ReadConnList: try to read connection from stream...");

                            if ((reader.BaseStream.Length - reader.BaseStream.Position) >= size)
                            {
                                object result;

                                if (reader.TryReadStruct(typeof(Connection_t), out result))
                                {
                                    logger.Info("CSTAConferenceCallConfParser.ReadConnList: successfully read connection from stream!");

                                    Connection_t connection = (Connection_t)result;

                                    logger.Info("CSTAConferenceCallConfParser.ReadConnList: connection.party.callID={0};connection.party.deviceID.device={1};connection.party.devIDType={2};connection.staticDevice.deviceID.device={3};connection.staticDevice.deviceIDType={4};connection.staticDevice.deviceIDType={4};", connection.party.callID, connection.party.deviceID.device, connection.party.devIDType, connection.staticDevice.deviceID.device, connection.staticDevice.deviceIDType);
                                    connections.Add(connection);
                                }
                            }
                        }
                    }

                    return(new ConnectionList_t()
                    {
                        count = count, connections = connections.ToArray()
                    });
                }
            }
            catch (Exception err)
            {
                logger.Error(string.Concat("Error in CSTAConferenceCallConfParser.ReadConnList: ", err.ToString()));
            }

            return(new ConnectionList_t()
            {
                count = 0, connections = new Connection_t[] { }
            });
        }