Пример #1
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            string familyStr = el.FirstArgument;
            AddressFamily family = AddressFamily.Unknown;
            if (familyStr == "AF_INET")
                family = AddressFamily.InterNetwork;
            else if (familyStr == "AF_INET6")
                family = AddressFamily.InterNetworkV6;

            string typeStr = el.SecondArgument;
            SocketType type = SocketType.Unknown;
            if (typeStr == "SOCK_STREAM")
                type = SocketType.Stream;
            else if (typeStr == "SOCK_DGRAM")
                type = SocketType.Dgram;

            string protocolStr = el.ThirdArgument;
            ProtocolType protocol = ProtocolType.Unknown;
            if (protocolStr == "IPPROTO_IP")
                protocol = ProtocolType.IP;

            uint result = el.ReturnValueAsUInt;

            return new CreateEvent(eventInformation, family, type, protocol, result);
        }
Пример #2
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            EndPoint ep = null;
            XmlNode saNode = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value");
            string family = saNode.SelectSingleNode("field[@name='sin_family']/value/@value").Value;
            if (family == "AF_INET")
            {
                string addr = saNode.SelectSingleNode("field[@name='sin_addr']/value/@value").Value;
                int port = Convert.ToInt32(saNode.SelectSingleNode("field[@name='sin_port']/value/@value").Value);
                ep = new IPEndPoint(IPAddress.Parse(addr), port);
            }

            ConnectResult result;
            if (el.ReturnValueAsInt == 0)
            {
                result = ConnectResult.Success;
            }
            else
            {
                if (el.LastError == 10035)
                    result = ConnectResult.WouldBlock;
                else
                    result = ConnectResult.Error;
            }

            return new ConnectEvent(eventInformation, socket, ep, result);
        }
Пример #3
0
 public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
 {
     FunctionCallDataElement el = new FunctionCallDataElement(eventData);
     uint socket = el.GetSimpleArgumentValueAsUInt(1);
     int result = el.ReturnValueAsInt;
     return new CloseEvent(eventInformation, socket, result);
 }
Пример #4
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);
            uint socket = el.GetSimpleArgumentValueAsUInt(1);
            int  result = el.ReturnValueAsInt;

            return(new CloseEvent(eventInformation, socket, result));
        }
Пример #5
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            string encodedBuffer = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value").InnerText.Trim();

            byte[] buffer = Convert.FromBase64String(encodedBuffer);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return(new SendEvent(eventInformation, socket, buffer, flags, result));
        }
Пример #6
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            string        familyStr = el.FirstArgument;
            AddressFamily family    = AddressFamily.Unknown;

            if (familyStr == "AF_INET")
            {
                family = AddressFamily.InterNetwork;
            }
            else if (familyStr == "AF_INET6")
            {
                family = AddressFamily.InterNetworkV6;
            }

            string     typeStr = el.SecondArgument;
            SocketType type    = SocketType.Unknown;

            if (typeStr == "SOCK_STREAM")
            {
                type = SocketType.Stream;
            }
            else if (typeStr == "SOCK_DGRAM")
            {
                type = SocketType.Dgram;
            }

            string       protocolStr = el.ThirdArgument;
            ProtocolType protocol    = ProtocolType.Unknown;

            if (protocolStr == "IPPROTO_IP")
            {
                protocol = ProtocolType.IP;
            }

            uint result = el.ReturnValueAsUInt;

            return(new CreateEvent(eventInformation, family, type, protocol, result));
        }
Пример #7
0
        public Event CreateEvent(EventInformation eventInformation, XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            byte[]  buffer     = null;
            XmlNode bufferNode = eventData.SelectSingleNode("/event/arguments[@direction='out']/argument[1]/value/value");

            if (bufferNode != null)
            {
                buffer = Convert.FromBase64String(bufferNode.InnerText.Trim());
            }

            int bufferSize = el.GetSimpleArgumentValueAsInt(3);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return(new ReceiveEvent(eventInformation, socket, buffer, bufferSize, flags, result));
        }
Пример #8
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            EndPoint ep     = null;
            XmlNode  saNode = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value");
            string   family = saNode.SelectSingleNode("field[@name='sin_family']/value/@value").Value;

            if (family == "AF_INET")
            {
                string addr = saNode.SelectSingleNode("field[@name='sin_addr']/value/@value").Value;
                int    port = Convert.ToInt32(saNode.SelectSingleNode("field[@name='sin_port']/value/@value").Value);
                ep = new IPEndPoint(IPAddress.Parse(addr), port);
            }

            ConnectResult result;

            if (el.ReturnValueAsInt == 0)
            {
                result = ConnectResult.Success;
            }
            else
            {
                if (el.LastError == 10035)
                {
                    result = ConnectResult.WouldBlock;
                }
                else
                {
                    result = ConnectResult.Error;
                }
            }

            return(new ConnectEvent(eventInformation, socket, ep, result));
        }
Пример #9
0
        public Event CreateEvent(EventInformation eventInformation, XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            byte[] buffer = null;
            XmlNode bufferNode = eventData.SelectSingleNode("/event/arguments[@direction='out']/argument[1]/value/value");
            if (bufferNode != null)
            {
                buffer = Convert.FromBase64String(bufferNode.InnerText.Trim());
            }

            int bufferSize = el.GetSimpleArgumentValueAsInt(3);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return new ReceiveEvent(eventInformation, socket, buffer, bufferSize, flags, result);
        }
Пример #10
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            string encodedBuffer = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value").InnerText.Trim();
            byte[] buffer = Convert.FromBase64String(encodedBuffer);

            int flags = el.GetSimpleArgumentValueAsInt(4);

            int result = el.ReturnValueAsInt;

            return new SendEvent(eventInformation, socket, buffer, flags, result);
        }