Ejemplo n.º 1
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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
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);
        }