Exemplo n.º 1
0
        public static Protocol createStack(Protocol middle, out Protocol bot)
        {
            ProtocolSinkStack stack = new ProtocolSinkStack(null,null);
            middle.ProtocolSinkStack = stack;

            TOP top = new TOP("TOP");
            BOTTOM bottom = new BOTTOM();
            bot = bottom;
            top.DownProtocol = middle;
            middle.DownProtocol = bottom;
            bottom.DownProtocol = null;

            top.UpProtocol = null;
            middle.UpProtocol = top;
            bottom.UpProtocol = middle;

            bottom.startDownHandler();
            bottom.startUpHandler();
            middle.startDownHandler();
            middle.startUpHandler();
            top.startDownHandler();
            top.startUpHandler();

            top.start();
            middle.start();
            bottom.start();

            bottom.up(new Event(Event.SET_LOCAL_ADDRESS,localAddr));

            return top;
        }
Exemplo n.º 2
0
        public static Protocol createStack(Protocol middle, out Protocol bot)
        {
            ProtocolSinkStack stack = new ProtocolSinkStack(null, null);

            middle.ProtocolSinkStack = stack;

            TOP    top    = new TOP("TOP");
            BOTTOM bottom = new BOTTOM();

            bot = bottom;
            top.DownProtocol    = middle;
            middle.DownProtocol = bottom;
            bottom.DownProtocol = null;

            top.UpProtocol    = null;
            middle.UpProtocol = top;
            bottom.UpProtocol = middle;

            bottom.startDownHandler();
            bottom.startUpHandler();
            middle.startDownHandler();
            middle.startUpHandler();
            top.startDownHandler();
            top.startUpHandler();


            top.start();
            middle.start();
            bottom.start();

            bottom.up(new Event(Event.SET_LOCAL_ADDRESS, localAddr));

            return(top);
        }