Exemplo n.º 1
0
        private int UnmanagedHandler(ref cHaggleEvent e, IntPtr arg)
        {
            Debug.WriteLine("Got haggle event type " + e.type);
            switch (e.type)
            {
            case HaggleEvent.SHUTDOWN:
                callback(new HaggleEvent(e));
                break;

            case HaggleEvent.NEIGHBOR_UPDATE:
                callback(new NeighborEvent(e));
                break;

            case HaggleEvent.NEW_DATAOBJECT:
                callback(new DataObjectEvent(e));
                break;

            case HaggleEvent.INTEREST_LIST:
                callback(new InterestsEvent(e));
                break;

            default:
                // Do not keep data -> return value != 1
                return(0);
            }

            // Keep data -> return 1
            return(1);
        }
Exemplo n.º 2
0
        public InterestsEvent(cHaggleEvent e)
            : base(e)
        {
            if (e.type != HaggleEvent.INTEREST_LIST)
            {
                throw new Exception("Not an interest list event");
            }

            interests = new Attribute.AttributeList(e.data);
        }
Exemplo n.º 3
0
        public DataObjectEvent(cHaggleEvent e)
            : base(e)
        {
            if (e.type != HaggleEvent.NEW_DATAOBJECT)
            {
                throw new Exception("Not a new data object event");
            }

            dObj = new DataObject(e.data);
        }
Exemplo n.º 4
0
        public DataObjectEvent(cHaggleEvent e)
            : base(e)
        {
            if (e.type != HaggleEvent.NEW_DATAOBJECT)
                        {
                                throw new Exception("Not a new data object event");
                        }

                        dObj = new DataObject(e.data);
        }
Exemplo n.º 5
0
        public NeighborEvent(cHaggleEvent e)
            : base(e)
        {
            if (e.type != HaggleEvent.NEIGHBOR_UPDATE)
            {
                throw new Exception("Not a neighbor update event");
            }

            neighbors = new Node.NodeList(e.data);
        }
Exemplo n.º 6
0
 public HaggleEvent(cHaggleEvent e)
 {
     this.type = e.type;
     this.data = e.data;
 }
Exemplo n.º 7
0
 public HaggleEvent(cHaggleEvent e)
 {
     this.type = e.type;
                 this.data = e.data;
 }
Exemplo n.º 8
0
        public NeighborEvent(cHaggleEvent e)
            : base(e)
        {
            if (e.type != HaggleEvent.NEIGHBOR_UPDATE)
                        {
                                throw new Exception("Not a neighbor update event");
                        }

                        neighbors = new Node.NodeList(e.data);
        }
Exemplo n.º 9
0
        public InterestsEvent(cHaggleEvent e)
            : base(e)
        {
            if (e.type != HaggleEvent.INTEREST_LIST)
                        {
                                throw new Exception("Not an interest list event");
                        }

                        interests = new Attribute.AttributeList(e.data);
        }
Exemplo n.º 10
0
        private int UnmanagedHandler(ref cHaggleEvent e, IntPtr arg)
        {
            Debug.WriteLine("Got haggle event type " + e.type);
                        switch (e.type)
                        {
                                case HaggleEvent.SHUTDOWN:
                                        callback(new HaggleEvent(e));
                                        break;
                                case HaggleEvent.NEIGHBOR_UPDATE:
                                        callback(new NeighborEvent(e));
                                        break;
                                case HaggleEvent.NEW_DATAOBJECT:
                                        callback(new DataObjectEvent(e));
                                        break;
                                case HaggleEvent.INTEREST_LIST:
                                        callback(new InterestsEvent(e));
                                        break;
                                default:
                                        // Do not keep data -> return value != 1
                                        return 0;
                        }

                        // Keep data -> return 1
                        return 1;
        }