DESERT 3.5.1
Loading...
Searching...
No Matches
uwtdma-frame.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
39#ifndef UWTDMA_FRAME_H
40#define UWTDMA_FRAME_H
41
42#include <uwtdma.h>
43#include <queue>
44#include <iostream>
45#include <assert.h>
46#include <sstream>
47#include <fstream>
48#include <sys/time.h>
49#include <vector>
50#include <map>
51
52
53
54typedef std::map<int, int> Slot;
55typedef std::map<int, Slot> SlotTopology;
56
57class UwTDMA_frame;
58
62class UwTDMA_frame : public UwTDMA
63{
64
65 friend class UwTDMATimer;
66
67public:
72
76 virtual ~UwTDMA_frame();
77
78protected:
88 virtual int command(int argc, const char *const *argv);
89
93 virtual void changeStatus();
94
99 virtual void initializeTopologyS();
100
101 Slot::iterator getCurrentSlot();
102 Slot::iterator getNextMySlot(int skip = 0);
103
118private:
123};
124
125#endif
UwTDMATimer class is used to handle the scheduling period of UWTDMA slots.
Definition uwtdma.h:65
Class that represents a TDMA_frame MAC layer of a Node.
Slot::iterator getCurrentSlot()
virtual void changeStatus()
Alternate TDMA status between MY_STATUS and NOT_MY_STATUS.
SlotTopology s_
matrix cointaining the transmission schedule of all the network
virtual ~UwTDMA_frame()
Destructor of the TDMA_frame class.
int topology_index
index in the topology matrix
string topology_S_file_name_
Topology S file name.
virtual void initializeTopologyS()
Initialize the topology S 2D matrix from file.
char topology_S_token_separator_
character used as token separator when importing the S topology from file
UwTDMA_frame()
Constructor of the TDMA_frame class.
Slot::iterator getNextMySlot(int skip=0)
int tot_nodes
total number of nodes in the network
int my_slots_counter
count the passed number of slots in which it was active
Slot my_slot_numbers_
set the position of the node in the frame (fair_mode) (starting from 0 to tot_slots-1)
int max_packet_per_slot
max numer of packet it can transmit per slot
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
int packet_sent_curr_slot_
counter of packet has been sent in the current slot
Class that represents a TDMA Node.
Definition uwtdma.h:92
std::map< int, int > Slot
std::map< int, Slot > SlotTopology
Provides the definition of the class UWTDMA.