a/src/DIF/RMT/RMTPort.h b/src/DIF/RMT/RMTPort.h
...
...
29
29
30
class RMTPort : public cSimpleModule
30
class RMTPort : public cSimpleModule
31
{
31
{
32
    /* tight coupling for management purposes */
32
    /* tight coupling for management purposes */
33
    friend class RA;
33
    friend class RA;
34
    friend class RMT;
34
    friend class RMTModuleAllocator;
35
    friend class RMTModuleAllocator;
35
36
36
  public:
37
  public:
37
38
38
    /**
39
    /**
40
     * Returns the port state (ready to send out data/busy).
41
     *
42
     * @return port state
43
     */
44
    bool isOutputReady();
45
46
    /**
39
     * Returns the port state (ready to receive data/busy).
47
     * Returns the port state (ready to receive data/busy).
40
     *
48
     *
41
     * @return port state
49
     * @return port state
42
     */
50
     */
43
    bool isReady();
51
    bool isInputReady();
44
45
    /**
46
     * Marks the port as ready to receive data.
47
     */
48
    void setReady();
49
50
    /**
51
     * Marks the port as busy (e.g. when sending data through it).
52
     */
53
    void setBusy();
54
52
55
    /**
53
    /**
56
     * Marks the port as blocked for sending (e.g. when (N-1)-EFCPI isn't keeping up).
54
     * Marks the port as blocked for sending (e.g. when (N-1)-EFCPI isn't keeping up).
57
     */
55
     */
58
    void blockOutput();
56
    void blockOutput();
...
...
74
72
75
    /**
73
    /**
76
     * Returns input block status.
74
     * Returns input block status.
77
     */
75
     */
78
    bool hasBlockedInput() { return blockedInput; };
76
    bool hasBlockedInput() { return blockedInput; };
77
78
    /*
79
     * Returns the input drain speed of this port.
80
     */
81
    long getInputRate();
82
83
    /*
84
     * Sets the input drain speed of this port.
85
     */
86
    void setInputRate(long pdusPerSecond);
79
87
80
    /**
88
    /**
81
     * Returns the (N-1)-flow this port is assigned to.
89
     * Returns the (N-1)-flow this port is assigned to.
82
     *
90
     *
83
     * @return (N-1)-flow object
91
     * @return (N-1)-flow object
...
...
135
    const RMTQueues& getOutputQueues() const;
143
    const RMTQueues& getOutputQueues() const;
136
144
137
    /**
145
    /**
138
     * Returns number of PDUs waiting to be read.
146
     * Returns number of PDUs waiting to be read.
139
     *
147
     *
148
     * @param direction of transfer (read/serve)
140
     * @return PDUs count accross queues
149
     * @return PDUs count accross queues
141
     */
150
     */
142
    unsigned long getWaitingOnInput() { return waitingOnInput; };
151
    unsigned long getWaiting(RMTQueueType direction);
143
144
    void addWaitingOnInput() { waitingOnInput++; };
145
    void substractWaitingOnInput() { waitingOnInput--; };
146
147
    /**
148
     * Returns number of PDUs waiting to be written.
149
     *
150
     * @return PDUs count accross queues
151
     */
152
    unsigned long getWaitingOnOutput() { return waitingOnOutput; };
153
154
    void addWaitingOnOutput() { waitingOnOutput++; };
155
    void substractWaitingOnOutput() { waitingOnOutput--; }
156
157
152
158
  protected:
153
  protected:
159
    virtual void initialize();
154
    virtual void initialize();
160
    virtual void handleMessage(cMessage* msg);
155
    virtual void handleMessage(cMessage* msg);
161
156
157
    /**
158
     * Increments number of waiting PDUs.
159
     *
160
     * @param direction of transfer (read/serve)
161
     */
162
    void addWaiting(RMTQueueType direction);
163
164
    /**
165
     * Decrements number of waiting PDUs.
166
     *
167
     * @param direction of transfer (read/serve)
168
     * @return PDUs count accross queues
169
     */
170
    void substractWaiting(RMTQueueType direction);
171
162
  private:
172
  private:
163
    bool ready;
173
    bool inputReady;
174
    bool outputReady;
164
    bool blockedInput;
175
    bool blockedInput;
165
    bool blockedOutput;
176
    bool blockedOutput;
166
    unsigned long waitingOnInput;
177
    unsigned long waitingOnInput;
167
    unsigned long waitingOnOutput;
178
    unsigned long waitingOnOutput;
179
    long inputReadRate;
168
    double postServeDelay;
180
    double postReadDelay;
169
    std::string dstAppAddr;
181
    std::string dstAppAddr;
170
182
171
    Flow* flow;
183
    Flow* flow;
172
    QueueIDGenBase* queueIdGen;
184
    QueueIDGenBase* queueIdGen;
173
185
...
...
176
    cGate* southOutputGate;
188
    cGate* southOutputGate;
177
    cChannel* outputChannel;
189
    cChannel* outputChannel;
178
190
179
    RMTQueues outputQueues;
191
    RMTQueues outputQueues;
180
    RMTQueues inputQueues;
192
    RMTQueues inputQueues;
193
194
    /**
195
     * Marks the port as ready to receive data.
196
     */
197
    void setOutputReady();
198
199
    /**
200
     * Marks the port as busy (e.g. when sending data through it).
201
     */
202
    void setOutputBusy();
203
204
    /**
205
     * Marks the port as ready to receive data.
206
     */
207
    void setInputReady();
208
209
    /**
210
     * Marks the port as busy (e.g. when sending data through it).
211
     */
212
    void setInputBusy();
181
213
182
    void postInitialize();
214
    void postInitialize();
183
    void setFlow(Flow* flow);
215
    void setFlow(Flow* flow);
184
    void registerInputQueue(RMTQueue* queue);
216
    void registerInputQueue(RMTQueue* queue);
185
    void registerOutputQueue(RMTQueue* queue);
217
    void registerOutputQueue(RMTQueue* queue);
186
    void unregisterInputQueue(RMTQueue* queue);
218
    void unregisterInputQueue(RMTQueue* queue);
187
    void unregisterOutputQueue(RMTQueue* queue);
219
    void unregisterOutputQueue(RMTQueue* queue);
188
    cGate* getSouthInputGate() const;
220
    cGate* getSouthInputGate() const;
189
    cGate* getSouthOutputGate() const;
221
    cGate* getSouthOutputGate() const;
190
222
191
    void setReadyDelayed();
223
    void scheduleNextRead();
224
    void scheduleNextWrite();
192
    void redrawGUI(bool redrawParent = false);
225
    void redrawGUI(bool redrawParent = false);
193
226
194
    simsignal_t sigRMTPortReady;
227
    simsignal_t sigRMTPortReadyForRead;
228
    simsignal_t sigRMTPortReadyToWrite;
195
    simsignal_t sigStatRMTPortUp;
229
    simsignal_t sigStatRMTPortUp;
196
    simsignal_t sigStatRMTPortDown;
230
    simsignal_t sigStatRMTPortDown;
197
};
231
};
198
232
199
typedef std::vector<RMTPort*> RMTPorts;
233
typedef std::vector<RMTPort*> RMTPorts;