Exemplo n.º 1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="stack">Owner SIP stack.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stack</b> is null reference.</exception>
        internal SIP_TransportLayer(SIP_Stack stack)
        {
            if(stack == null){
                throw new ArgumentNullException("stack");
            }

            m_pStack = stack;

            m_pUdpServer = new UDP_Server();
            m_pUdpServer.ProcessMode = UDP_ProcessMode.Parallel;
            m_pUdpServer.PacketReceived += new PacketReceivedHandler(m_pUdpServer_PacketReceived);
            m_pUdpServer.Error += new ErrorEventHandler(m_pUdpServer_Error);

            m_pTcpServer = new TCP_Server<TCP_ServerSession>();
            m_pTcpServer.SessionCreated += new EventHandler<TCP_ServerSessionEventArgs<TCP_ServerSession>>(m_pTcpServer_SessionCreated);

            m_pFlowManager = new SIP_FlowManager(this);

            m_pBinds = new IPBindInfo[]{};

            m_pRandom = new Random();

            m_pLocalIPv4 = new CircleCollection<IPAddress>();
            m_pLocalIPv6 = new CircleCollection<IPAddress>();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="server">UDP server which received packet.</param>
 /// <param name="socket">Socket which received packet.</param>
 /// <param name="remoteEP">Remote end point which sent data.</param>
 /// <param name="data">UDP data.</param>
 internal UDP_PacketEventArgs(UDP_Server server,Socket socket,IPEndPoint remoteEP,byte[] data)
 {
     m_pUdpServer = server;
     m_pSocket    = socket;
     m_pRemoteEP  = remoteEP;
     m_pData      = data;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="server">UDP server which received packet.</param>
 /// <param name="socket">Socket which received packet.</param>
 /// <param name="remoteEP">Remote end point which sent data.</param>
 /// <param name="data">UDP data.</param>
 internal UDP_PacketEventArgs(UDP_Server server, Socket socket, IPEndPoint remoteEP, byte[] data)
 {
     m_pUdpServer = server;
     m_pSocket    = socket;
     m_pRemoteEP  = remoteEP;
     m_pData      = data;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        internal void Dispose()
        {
            if(m_IsDisposed){
                return;
            }
            m_IsDisposed = true;

            Stop();

            m_IsRunning  = false;
            m_pBinds    = null;
            m_pRandom   = null;

            m_pTcpServer.Dispose();
            m_pTcpServer = null;

            m_pUdpServer.Dispose();
            m_pUdpServer = null;
        }