F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Channel.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Channel.cpp
3 // \brief CFDP Channel operations implementation
4 //
5 // This file is a port of channel-specific functions from the following files
6 // from the NASA Core Flight System (cFS) CFDP (CF) Application, version 3.0.0,
7 // adapted for use within the F-Prime (F') framework:
8 // - cf_cfdp.c (channel processing functions)
9 // - cf_utils.c (channel transaction and resource management)
10 //
11 // ======================================================================
12 //
13 // NASA Docket No. GSC-18,447-1
14 //
15 // Copyright (c) 2019 United States Government as represented by the
16 // Administrator of the National Aeronautics and Space Administration.
17 // All Rights Reserved.
18 //
19 // Licensed under the Apache License, Version 2.0 (the "License");
20 // you may not use this file except in compliance with the License.
21 // You may obtain a copy of the License at
22 //
23 // http://www.apache.org/licenses/LICENSE-2.0
24 //
25 // Unless required by applicable law or agreed to in writing, software
26 // distributed under the License is distributed on an "AS IS" BASIS,
27 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 // See the License for the specific language governing permissions and
29 // limitations under the License.
30 //
31 // ======================================================================
32 
33 #include <string.h>
34 #include <new>
35 
36 #include <Fw/FPrimeBasicTypes.hpp>
37 
42 
43 namespace Svc {
44 namespace Ccsds {
45 namespace Cfdp {
46 
47 // ----------------------------------------------------------------------
48 // Construction
49 // ----------------------------------------------------------------------
50 
52  U8 channelId,
54  Fw::MemAllocator& allocator,
55  FwEnumStoreType memId)
56  : m_engine(engine),
57  m_numCmdTx(0),
58  m_numRx(0),
59  m_currentTxn(nullptr),
60  m_cfdpManager(cfdpManager),
61  m_tickType(0),
62  m_channelId(channelId),
63  m_flowState(Cfdp::Flow::NOT_FROZEN),
64  m_outgoingCounter(0),
65  m_transactions(nullptr),
66  m_histories(nullptr),
67  m_chunks(nullptr),
68  m_chunkMem(nullptr) {
69  FW_ASSERT(engine != nullptr);
70  FW_ASSERT(cfdpManager != nullptr);
71 
72  // Initialize queue pointers
73  for (U32 i = 0; i < QueueId::NUM; i++) {
74  m_qs[i] = nullptr;
75  }
76 
77  // Initialize command/history lists
78  for (U32 i = 0; i < static_cast<U32>(Direction::DIRECTION_NUM); i++) {
79  m_cs[i] = nullptr;
80  }
81 
82  // Initialize poll directory playback state
83  for (U32 i = 0; i < MaxPollingDirPerChan; i++) {
84  m_polldir[i].enabled = Fw::Enabled::DISABLED;
85  m_polldir[i].pb.busy = false;
86  m_polldir[i].pb.diropen = false;
87  m_polldir[i].pb.counted = false;
88  m_polldir[i].pb.num_ts = 0;
89  m_polldir[i].pb.pending_file = "";
90  }
91 
92  // Initialize playback structures
93  for (U32 i = 0; i < MaxCommandedPlaybackDirectoriesPerChan; i++) {
94  m_playback[i].busy = false;
95  m_playback[i].diropen = false;
96  m_playback[i].counted = false;
97  m_playback[i].num_ts = 0;
98  m_playback[i].pending_file = "";
99  }
100 
101  // Allocate and initialize per-channel resources
102  U32 j, k;
103  History* history;
104  Transaction* txn;
105  CfdpChunkWrapper* cw;
106  CListNode** list_head;
107  U32 chunk_mem_offset = 0;
108  U32 total_chunks_needed;
109 
110  // Initialize chunk configuration for this channel
111  const U32 rxChunksPerChannel[] = CFDP_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION;
112  const U32 txChunksPerChannel[] = CFDP_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION;
113  m_dirMaxChunks[static_cast<U32>(Direction::DIRECTION_RX)] = rxChunksPerChannel[m_channelId];
114  m_dirMaxChunks[static_cast<U32>(Direction::DIRECTION_TX)] = txChunksPerChannel[m_channelId];
115 
116  // Calculate total chunks needed for this channel
117  total_chunks_needed = 0;
118  for (k = 0; k < static_cast<U32>(Direction::DIRECTION_NUM); ++k) {
119  total_chunks_needed += m_dirMaxChunks[k] * CFDP_NUM_TRANSACTIONS_PER_CHANNEL;
120  }
121 
122  // Allocate arrays using the provided allocator
123  FwSizeType transactionsSize = CFDP_NUM_TRANSACTIONS_PER_CHANNEL * sizeof(Transaction);
124  m_transactions = static_cast<Transaction*>(allocator.allocate(memId, transactionsSize));
125  FW_ASSERT(m_transactions != nullptr);
126 
127  FwSizeType chunksSize =
129  m_chunks = static_cast<CfdpChunkWrapper*>(allocator.allocate(memId, chunksSize));
130  FW_ASSERT(m_chunks != nullptr);
131 
132  FwSizeType historiesSize = NumHistoriesPerChannel * sizeof(History);
133  m_histories = static_cast<History*>(allocator.allocate(memId, historiesSize));
134  FW_ASSERT(m_histories != nullptr);
135 
136  FwSizeType chunkMemSize = total_chunks_needed * sizeof(Chunk);
137  m_chunkMem = static_cast<Chunk*>(allocator.allocate(memId, chunkMemSize));
138  FW_ASSERT(m_chunkMem != nullptr);
139 
140  // Initialize transactions using placement new with parameterized constructor
141  cw = m_chunks;
142  for (j = 0; j < CFDP_NUM_TRANSACTIONS_PER_CHANNEL; ++j) {
143  // Construct transaction in-place with parameterized constructor
144  txn = new (&m_transactions[j]) Transaction(this, m_channelId, m_engine, m_cfdpManager);
145 
146  // Put transaction on free list
147  this->freeTransaction(txn);
148 
149  // Initialize chunk wrappers for this transaction (TX and RX)
150  for (k = 0; k < static_cast<U32>(Direction::DIRECTION_NUM); ++k, ++cw) {
151  list_head = this->getChunkListHead(static_cast<U8>(k));
152 
153  // Use placement new to construct CfdpChunkWrapper with the new class-based interface
154  new (cw) CfdpChunkWrapper(static_cast<ChunkIdx>(m_dirMaxChunks[k]), &m_chunkMem[chunk_mem_offset]);
155  chunk_mem_offset += m_dirMaxChunks[k];
157  CfdpCListInsertBack(list_head, &cw->cl_node);
158  }
159  }
160 
161  // Initialize histories using placement new (History contains Fw::String which needs proper construction)
162  for (j = 0; j < NumHistoriesPerChannel; ++j) {
163  history = new (&m_histories[j]) History(); // Use placement new with default constructor
164  CfdpCListInitNode(&history->cl_node);
165  this->insertBackInQueue(QueueId::HIST_FREE, &history->cl_node);
166  }
167 }
168 
170  // Cleanup should have been called before destruction
171  // This is enforced by Engine::~Engine()
172 }
173 
175  // Call destructors and deallocate all internal arrays
176  if (m_transactions != nullptr) {
177  // Manually call destructors since we used placement new
178  for (U32 j = 0; j < CFDP_NUM_TRANSACTIONS_PER_CHANNEL; ++j) {
179  m_transactions[j].~Transaction();
180  }
181  allocator.deallocate(memId, m_transactions);
182  m_transactions = nullptr;
183  }
184 
185  if (m_chunks != nullptr) {
186  // Manually call destructors since we used placement new
187  for (U32 j = 0; j < (CFDP_NUM_TRANSACTIONS_PER_CHANNEL * static_cast<U32>(Direction::DIRECTION_NUM)); ++j) {
188  m_chunks[j].~CfdpChunkWrapper();
189  }
190  allocator.deallocate(memId, m_chunks);
191  m_chunks = nullptr;
192  }
193 
194  if (m_histories != nullptr) {
195  // Call destructors on History objects
196  for (U32 j = 0; j < NumHistoriesPerChannel; ++j) {
197  m_histories[j].~History();
198  }
199  allocator.deallocate(memId, m_histories);
200  m_histories = nullptr;
201  }
202 
203  if (m_chunkMem != nullptr) {
204  allocator.deallocate(memId, m_chunkMem);
205  m_chunkMem = nullptr;
206  }
207 }
208 
209 // ----------------------------------------------------------------------
210 // Channel Processing
211 // ----------------------------------------------------------------------
212 
214  Transaction* txn;
215  CycleTxArgs args;
216 
217  if (m_cfdpManager->getDequeueEnabledParam(m_channelId)) {
218  args.chan = this;
219  args.ran_one = 0;
220 
221  // loop through as long as there are pending transactions, and a message buffer to send their PDUs on
222 
223  // NOTE: tick processing is higher priority than sending new filedata PDUs, so only send however many
224  // PDUs that can be sent once we get to here
225  if (!this->m_currentTxn) { // don't enter if currentTxn is set, since we need to pick up where we left off on
226  // tick processing next scheduler cycle
227 
228  // Process pending transactions until queue is empty or something runs
229  while (true) {
230  // Context for static wrapper: pass both Channel* and CycleTxArgs*
231  struct CycleTxContext {
232  Channel* channel;
233  CycleTxArgs* args;
234  } cycleTxCtx = {this, &args};
235 
236  // Attempt to run something on TXA
238 
239  // Keep going until QueueId::PEND is empty or something is run
240  if (args.ran_one || m_qs[QueueId::PEND] == nullptr) {
241  break;
242  }
243 
244  txn = container_of_cpp(m_qs[QueueId::PEND], &Transaction::m_cl_node);
245 
246  // Class 2 transactions need a chunklist for NAK processing, get one now.
247  // Class 1 transactions don't need chunks since they don't support NAKs.
248  if (txn->getClass() == Cfdp::Class::CLASS_2) {
249  if (txn->m_chunks == nullptr) {
250  txn->m_chunks = this->findUnusedChunks(Direction::DIRECTION_TX);
251  }
252  if (txn->m_chunks == nullptr) {
253  // Chunklist unavailable - EVR already emitted by Engine
254  // Leave transaction pending until a chunklist is available.
255  break;
256  }
257  }
258 
259  m_engine->armInactTimer(txn);
260  this->moveTransaction(txn, QueueId::TXA);
261  }
262  }
263 
264  // in case the loop exited due to no message buffers, clear it and start from the top next time
265  this->m_currentTxn = nullptr;
266  }
267 }
268 
270  bool reset = true;
271 
272  void (Transaction::* fns[static_cast<U8>(CfdpTickType::CFDP_TICK_TYPE_NUM_TYPES)])(I32*) = {
275 
276  FW_ASSERT(m_tickType < static_cast<U8>(CfdpTickType::CFDP_TICK_TYPE_NUM_TYPES), m_tickType);
277 
278  for (; m_tickType < static_cast<U8>(CfdpTickType::CFDP_TICK_TYPE_NUM_TYPES); ++m_tickType) {
279  TickArgs args = {this, fns[m_tickType], 0, 0};
280 
281  // Safety bound: retry loop should not exceed the number of transactions in the queue
282  // Each retry processes one transaction that may request continuation
283  constexpr U32 maxRetries = MaxSimultaneousRx + MaxCommandedPlaybackFilesPerChan +
286 
287  for (U32 retry = 0; retry < maxRetries; ++retry) {
288  args.cont = 0;
289 
290  // Context for static wrapper: pass both Channel* and TickArgs*
291  struct TickContext {
292  Channel* channel;
293  TickArgs* args;
294  } tickCtx = {this, &args};
295 
296  CfdpCListTraverse(m_qs[qs[m_tickType]], &Channel::doTickWrapper, &tickCtx);
297 
298  if (args.early_exit) {
299  // early exit means we ran out of available outgoing messages this scheduler cycle.
300  // If current tick type is NAK response, then reset tick type. It would be
301  // bad to let NAK response starve out RX or TXW ticks on the next cycle.
302  //
303  // If RX ticks use up all available messages, then we pick up where we left
304  // off on the next cycle. (This causes some RX tick counts to be missed,
305  // but that's ok. Precise timing isn't required.)
306  //
307  // This scheme allows the following priority for use of outgoing messages:
308  //
309  // RX state messages
310  // TXW state messages
311  // NAK response (could be many)
312  //
313  // New file data on TXA
314  if (m_tickType != static_cast<U8>(CfdpTickType::CFDP_TICK_TYPE_TXW_NAK)) {
315  reset = false;
316  }
317 
318  break;
319  }
320 
321  if (!args.cont) {
322  break; // No continuation requested, exit retry loop
323  }
324  }
325 
326  if (!reset) {
327  break;
328  }
329  }
330 
331  if (reset) {
332  m_tickType = static_cast<U8>(CfdpTickType::CFDP_TICK_TYPE_RX); // reset tick type
333  }
334 }
335 
337  U32 i;
338  U8 playback_count = 0;
339 
340  for (i = 0; i < MaxCommandedPlaybackDirectoriesPerChan; ++i) {
341  this->processPlaybackDirectory(&m_playback[i]);
342  // Count active playback operations
343  if (m_playback[i].busy) {
344  playback_count++;
345  }
346  }
347 
348  // Update playback counter telemetry
349  Cfdp::ChannelTelemetry& tlm = m_engine->getChannelTelemetryRef(m_channelId);
350  tlm.set_playbackCounter(playback_count);
351 }
352 
354  CfdpPollDir* pd;
355  U32 i;
356  U8 poll_count = 0;
357 
358  for (i = 0; i < MaxPollingDirPerChan; ++i) {
359  pd = &m_polldir[i];
360 
361  if (pd->enabled) {
362  poll_count++;
363 
364  if ((pd->pb.busy == false) && (pd->pb.num_ts == 0)) {
365  if (pd->intervalTimer.getStatus() == Timer::Status::EXPIRED) {
366  // the timer has expired, so initiate a playback of the directory.
367  // The return status is intentionally ignored: playbackDirInitiate
368  // already emits an event on failure and the timer is re-armed
369  // below regardless so polling retries after the interval.
370  (void)m_engine->playbackDirInitiate(&pd->pb, pd->srcDir, pd->dstDir, pd->cfdpClass,
371  Cfdp::Keep::DELETE, m_channelId, pd->priority, pd->destEid);
372  // re-arm the timer for the next interval. The timer only ticks
373  // down while the playback is not busy.
374  if (pd->intervalSec > 0) {
376  }
377  } else {
378  pd->intervalTimer.run();
379  }
380  } else {
381  // playback is active, so step it
382  this->processPlaybackDirectory(&pd->pb);
383  }
384  }
385  }
386 
387  // Update poll counter telemetry
388  Cfdp::ChannelTelemetry& tlm = m_engine->getChannelTelemetryRef(m_channelId);
389  tlm.set_pollCounter(poll_count);
390 }
391 
392 // ----------------------------------------------------------------------
393 // Transaction Management
394 // ----------------------------------------------------------------------
395 
397  CListNode* node;
398  Transaction* txn;
399  QueueId::T q_index; // initialized below in if
400 
401  if (m_qs[QueueId::FREE]) {
402  node = m_qs[QueueId::FREE];
403  txn = container_of_cpp(node, &Transaction::m_cl_node);
404 
405  this->removeFromQueue(QueueId::FREE, &txn->m_cl_node);
406 
407  // now that a transaction is acquired, must also acquire a history slot to go along with it
408  if (m_qs[QueueId::HIST_FREE]) {
409  q_index = QueueId::HIST_FREE;
410  } else {
411  // no free history, so take the oldest one from the channel's history queue
412  FW_ASSERT(m_qs[QueueId::HIST]);
413  q_index = QueueId::HIST;
414  }
415 
416  txn->m_history = container_of_cpp(m_qs[q_index], &History::cl_node);
417 
418  this->removeFromQueue(q_index, &txn->m_history->cl_node);
419 
420  // Reset all history fields to initial state (matches constructor zero-init)
421  // This is necessary when recycling from HIST queue to clear stale data
422  txn->m_history->txn_stat = TxnStatus::TXN_STATUS_UNDEFINED; // Critical: prevents error status inheritance
423  txn->m_history->src_eid = 0;
424  txn->m_history->peer_eid = 0;
425  txn->m_history->seq_num = 0;
426  txn->m_history->fnames.src_filename = "";
427  txn->m_history->fnames.dst_filename = "";
428  // Note: cl_node is managed by queue operations (already handled by removeFromQueue)
429  // Note: dir is explicitly set below (already handled)
430 
431  // Indicate that this was freshly pulled from the free list
432  // notably this state is distinguishable from items still on the free list
433  txn->m_state = TxnState::TXN_STATE_INIT;
434 
435  // Clear the FREE tag now that this transaction has been taken off the FREE
436  // list. freeTransaction() marks q_index == QueueId::FREE for anything sitting
437  // on the free list; leaving that tag set on an acquired-but-not-yet-enqueued
438  // transaction would break the invariant relied on by
439  // Engine::finishTransaction()'s double-free guard (a live txn must never look
440  // FREE). The caller (startRxTransaction / txFileInitiate) will assign the real
441  // queue via insertSortPrio()/direct assignment; until then PEND (0) is the
442  // neutral, not-on-FREE-list default that matches reset()'s zeroed m_flags.
443  txn->m_flags.com.q_index = QueueId::PEND;
444 
445  txn->m_history->dir = direction;
446  txn->m_chan = this; // Set channel pointer
447 
448  // Re-initialize the linked list node to clear stale pointers from FREE list
449  CfdpCListInitNode(&txn->m_cl_node);
450  } else {
451  txn = nullptr;
452  }
453 
454  return txn;
455 }
456 
458  // need to find transaction by sequence number. It will either be the active transaction (front of Q_PEND),
459  // or on Q_TX or Q_RX. Once a transaction moves to history, then it's done.
460  //
461  // Let's put QueueId::RX up front, because most RX packets will be file data PDUs
462  CfdpTraverseTransSeqArg ctx = {transaction_sequence_number, src_eid, nullptr};
463  CListNode* ptrs[] = {m_qs[QueueId::RX], m_qs[QueueId::PEND], m_qs[QueueId::TXA], m_qs[QueueId::TXW]};
464  Transaction* ret = nullptr;
465 
466  for (CListNode* head : ptrs) {
468  if (ctx.txn) {
469  ret = ctx.txn;
470  break;
471  }
472  }
473 
474  return ret;
475 }
476 
478  I32 counter = 0;
479 
480  // Context for static wrapper
481  struct TraverseAllContext {
483  void* userContext;
484  I32* counter;
485  } ctx = {fn, context, &counter};
486 
487  for (I32 queueidx = QueueId::PEND; queueidx <= QueueId::RX; ++queueidx) {
489  }
490 
491  return counter;
492 }
493 
495  this->removeFromQueue(QueueId::HIST, &history->cl_node);
496  this->insertBackInQueue(QueueId::HIST_FREE, &history->cl_node);
497 }
498 
499 // ----------------------------------------------------------------------
500 // Transaction Queue Management
501 // ----------------------------------------------------------------------
502 
504  FW_ASSERT(txn);
505  CfdpCListRemove(&m_qs[txn->m_flags.com.q_index], &txn->m_cl_node);
506 
507  // Update queue depth telemetry
508  Cfdp::ChannelTelemetry& tlm = m_engine->getChannelTelemetryRef(m_channelId);
509  switch (txn->m_flags.com.q_index) {
510  case Cfdp::QueueId::FREE:
511 
512  tlm.set_queueFree(static_cast<U16>(tlm.get_queueFree() - 1));
513  break;
514  case Cfdp::QueueId::TXA:
515 
516  tlm.set_queueTxActive(static_cast<U16>(tlm.get_queueTxActive() - 1));
517  break;
518  case Cfdp::QueueId::TXW:
519 
520  tlm.set_queueTxWaiting(static_cast<U16>(tlm.get_queueTxWaiting() - 1));
521  break;
522  case Cfdp::QueueId::RX:
523 
524  tlm.set_queueRx(static_cast<U16>(tlm.get_queueRx() - 1));
525  break;
526  case Cfdp::QueueId::HIST:
527 
528  tlm.set_queueHistory(static_cast<U16>(tlm.get_queueHistory() - 1));
529  break;
530  case Cfdp::QueueId::PEND:
532  // PEND and HIST_FREE queues are not tracked in telemetry
533  break;
534  default:
535  FW_ASSERT(0, txn->m_flags.com.q_index);
536  }
537 }
538 
540  FW_ASSERT(txn);
541  Cfdp::ChannelTelemetry& tlm = m_engine->getChannelTelemetryRef(m_channelId);
542 
543  // Decrement old queue
544  CfdpCListRemove(&m_qs[txn->m_flags.com.q_index], &txn->m_cl_node);
545  switch (txn->m_flags.com.q_index) {
546  case Cfdp::QueueId::FREE:
547 
548  tlm.set_queueFree(static_cast<U16>(tlm.get_queueFree() - 1));
549  break;
550  case Cfdp::QueueId::TXA:
551 
552  tlm.set_queueTxActive(static_cast<U16>(tlm.get_queueTxActive() - 1));
553  break;
554  case Cfdp::QueueId::TXW:
555 
556  tlm.set_queueTxWaiting(static_cast<U16>(tlm.get_queueTxWaiting() - 1));
557  break;
558  case Cfdp::QueueId::RX:
559 
560  tlm.set_queueRx(static_cast<U16>(tlm.get_queueRx() - 1));
561  break;
562  case Cfdp::QueueId::HIST:
563 
564  tlm.set_queueHistory(static_cast<U16>(tlm.get_queueHistory() - 1));
565  break;
566  case Cfdp::QueueId::PEND:
568  // PEND and HIST_FREE queues are not tracked in telemetry
569  break;
570  default:
571  FW_ASSERT(0, txn->m_flags.com.q_index);
572  }
573 
574  // Increment new queue
575  CfdpCListInsertBack(&m_qs[queue], &txn->m_cl_node);
576  txn->m_flags.com.q_index = queue;
577  switch (queue) {
578  case Cfdp::QueueId::FREE:
579  tlm.set_queueFree(static_cast<U16>(tlm.get_queueFree() + 1));
580  break;
581  case Cfdp::QueueId::TXA:
582  tlm.set_queueTxActive(static_cast<U16>(tlm.get_queueTxActive() + 1));
583  break;
584  case Cfdp::QueueId::TXW:
585  tlm.set_queueTxWaiting(static_cast<U16>(tlm.get_queueTxWaiting() + 1));
586  break;
587  case Cfdp::QueueId::RX:
588  tlm.set_queueRx(static_cast<U16>(tlm.get_queueRx() + 1));
589  break;
590  case Cfdp::QueueId::HIST:
591  tlm.set_queueHistory(static_cast<U16>(tlm.get_queueHistory() + 1));
592  break;
593  case Cfdp::QueueId::PEND:
595  // PEND and HIST_FREE queues are not tracked in telemetry
596  break;
597  default:
598  FW_ASSERT(0, queue);
599  }
600 }
601 
603  // Reset transaction to default state (preserves channel context)
604  txn->reset();
605 
606  // Initialize the linked list node for the FREE queue
607  CfdpCListInitNode(&txn->m_cl_node);
608  this->insertBackInQueue(QueueId::FREE, &txn->m_cl_node);
609 
610  // Mark the transaction as residing on the FREE list. insertBackInQueue() only
611  // performs the list insertion (unlike insertSortPrio(), which also updates
612  // q_index), and txn->reset() zeroes m_flags so q_index would otherwise be left
613  // at 0 (== QueueId::PEND). Without this, a freed transaction is never tagged
614  // FREE, and Engine::finishTransaction()'s double-free guard
615  // (q_index == QueueId::FREE) can never fire. Setting it here upholds the
616  // invariant: "a transaction on the FREE list has q_index == FREE".
617  txn->m_flags.com.q_index = QueueId::FREE;
618 }
619 
621  CListNode** chunklist_head;
622  QueueId::T hist_destq;
623 
624  // File should have been closed by the state machine, but if
625  // it still hanging open at this point, close it now so its not leaked.
626  // This is not normal/expected so log it if this happens.
627  if (true == txn->m_fd.isOpen()) {
628  this->m_cfdpManager->log_WARNING_LO_DanglingFileHandleClosed(txn->getChannelId(), txn->m_history->seq_num);
629  txn->m_fd.close();
630  }
631 
632  this->dequeueTransaction(txn); // this makes it "float" (not in any queue)
633 
634  // this should always be
635  if (txn->m_history != nullptr) {
636  if (txn->m_history->dir == Direction::DIRECTION_RX) {
637  // Every RX transaction is allocated through Engine::startRxTransaction(), which
638  // counts it; this is the single release point.
639  this->decrementRxCounter();
640  }
641 
642  if (txn->m_chunks != nullptr) {
643  chunklist_head = this->getChunkListHead(static_cast<U8>(txn->m_history->dir));
644  if (chunklist_head != nullptr) {
645  // Reset chunk list to clear stale data from previous transaction
646  txn->m_chunks->chunks.reset();
647  CfdpCListInsertBack(chunklist_head, &txn->m_chunks->cl_node);
648  txn->m_chunks = nullptr;
649  }
650  }
651 
652  if (txn->m_flags.com.keep_history) {
653  // move transaction history to history queue
654  hist_destq = QueueId::HIST;
655  } else {
656  hist_destq = QueueId::HIST_FREE;
657  }
658  this->insertBackInQueue(hist_destq, &txn->m_history->cl_node);
659  txn->m_history = nullptr;
660  }
661 
662  // this wipes it and puts it back onto the list to be found by
663  // Channel::findUnusedTransaction(). Need to preserve the chan_num
664  // and keep it associated with this channel, though.
665  this->freeTransaction(txn);
666 }
667 
669  bool insert_back = false;
670 
671  FW_ASSERT(txn);
672 
673  // look for proper position on PEND queue for this transaction.
674  // This is a simple priority sort.
675 
676  if (!m_qs[queue]) {
677  // list is empty, so just insert
678  insert_back = true;
679  } else {
680  CfdpTraversePriorityArg arg = {nullptr, txn->getPriority()};
682  if (arg.txn) {
683  this->insertAfterInQueue(queue, &arg.txn->m_cl_node, &txn->m_cl_node);
684  } else {
685  insert_back = true;
686  }
687  }
688 
689  if (insert_back) {
690  this->insertBackInQueue(queue, &txn->m_cl_node);
691  }
692  txn->m_flags.com.q_index = queue;
693 }
694 
695 // ----------------------------------------------------------------------
696 // Channel State Management
697 // ----------------------------------------------------------------------
698 
700  FW_ASSERT(m_numCmdTx); // sanity check
701  --m_numCmdTx;
702 }
703 
705  FW_ASSERT(m_numRx); // sanity check
706  --m_numRx;
707 }
708 
710  // Done with this TX transaction
711  if (this->m_currentTxn == txn) {
712  this->m_currentTxn = nullptr;
713  }
714 }
715 
717  this->m_currentTxn = txn;
718 }
719 
720 // ----------------------------------------------------------------------
721 // Resource Management
722 // ----------------------------------------------------------------------
723 
725  CListNode** result;
726 
727  if (direction < static_cast<U32>(Direction::DIRECTION_NUM)) {
728  result = &m_cs[direction];
729  } else {
730  result = nullptr;
731  }
732 
733  return result;
734 }
735 
737  CfdpChunkWrapper* ret = nullptr;
738  CListNode* node;
739  CListNode** chunklist_head;
740 
741  chunklist_head = this->getChunkListHead(static_cast<U8>(dir));
742 
743  // this should never be null
744  FW_ASSERT(chunklist_head);
745 
746  if (*chunklist_head != nullptr) {
747  node = CfdpCListPop(chunklist_head);
748  if (node != nullptr) {
750  }
751  }
752 
753  return ret;
754 }
755 
756 // ----------------------------------------------------------------------
757 // Private helper methods
758 // ----------------------------------------------------------------------
759 
760 void Channel::processPlaybackDirectory(Playback* pb) {
761  Transaction* txn;
763  Os::Directory::Status status;
764 
765  // either there's no transaction (first one) or the last one was finished, so check for a new one
766 
767  while (pb->diropen && (pb->num_ts < NumTransactionsPerPlayback)) {
768  if (pb->pending_file.length() == 0) {
769  status = pb->dir.read(path);
770  if (status == Os::Directory::NO_MORE_FILES) {
771  // Directory playback complete - success reported via TxFileTransferCompleted EVR
772  pb->dir.close();
773  pb->diropen = false;
774  break;
775  }
776  if (status != Os::Directory::OP_OK) {
777  // Directory read error - emit EVR and close playback
779  static_cast<I32>(status));
780  pb->dir.close();
781  pb->diropen = false;
782  break;
783  }
784 
785  pb->pending_file = path;
786  } else {
787  // Skip entries whose combined "<dir>/<entry>" source or destination path
788  // would not fit the MaxFilePathSize limit enforced by the metadata PDU.
789  // Checked before a transaction is acquired so no slot is consumed for it.
790  const FwSizeType maxPathLen = static_cast<FwSizeType>(MaxFilePathSize);
791  const FwSizeType srcPathLen = pb->fnames.src_filename.length() + 1 + pb->pending_file.length();
792  const FwSizeType dstPathLen = pb->fnames.dst_filename.length() + 1 + pb->pending_file.length();
793  const bool srcTooLong = (srcPathLen > maxPathLen);
794  const bool dstTooLong = (dstPathLen > maxPathLen);
795  if (srcTooLong) {
796  this->m_cfdpManager->log_WARNING_LO_PlaybackSourcePathTooLong(
797  srcPathLen, maxPathLen, pb->fnames.src_filename, pb->pending_file);
798  }
799  if (dstTooLong) {
801  dstPathLen, maxPathLen, pb->fnames.dst_filename, pb->pending_file);
802  }
803  if (srcTooLong || dstTooLong) {
804  pb->pending_file = ""; // continue reading dir
805  continue;
806  }
807 
809  if (txn == nullptr) {
810  // while not expected this can certainly happen, because
811  // rx transactions consume in these as well.
812  // should not need to do anything special, will come back next tick
813  break;
814  }
815 
816  // Append file name to source/destination folders
817  txn->m_history->fnames.src_filename = pb->fnames.src_filename;
818  txn->m_history->fnames.src_filename += "/";
819  txn->m_history->fnames.src_filename += pb->pending_file;
820 
821  txn->m_history->fnames.dst_filename = pb->fnames.dst_filename;
822  txn->m_history->fnames.dst_filename += "/";
823  txn->m_history->fnames.dst_filename += pb->pending_file;
824 
825  m_engine->txFileInitiate(txn, pb->cfdp_class, pb->keep, m_channelId, pb->priority, pb->dest_id);
826 
827  txn->m_pb = pb;
828  ++pb->num_ts;
829 
830  pb->pending_file = ""; // continue reading dir
831  }
832  }
833 
834  if (!pb->diropen && !pb->num_ts) {
835  // the directory has been exhausted, and there are no more active transactions
836  // for this playback -- so mark it as not busy
837  pb->busy = false;
838  }
839 }
840 
841 void Channel::updatePollPbCounted(Playback* pb, I32 up, U8* counter) {
842  if (pb->counted != up) {
843  // only handle on state change
844  pb->counted = !!up; // !! ensure 0 or 1, should be optimized out
845 
846  if (up) {
847  ++*counter;
848  } else {
849  FW_ASSERT(*counter); // sanity check it isn't zero
850  --*counter;
851  }
852  }
853 }
854 
856  CycleTxArgs* args = static_cast<CycleTxArgs*>(context);
857  Transaction* txn = container_of_cpp(node, &Transaction::m_cl_node);
858  CListTraverseStatus ret = CLIST_TRAVERSE_EXIT; // default option is exit traversal
859 
860  if (txn->m_flags.com.suspended) {
861  ret = CLIST_TRAVERSE_CONTINUE; // suspended, so move on to next
862  } else {
863  FW_ASSERT(txn->m_flags.com.q_index == QueueId::TXA); // huh?
864 
865  // Only S1 and S2 transactions have a dispatchTx handler. Anything else on TXA
866  // (e.g. a finished transaction in HOLD) can never satisfy the loop exit conditions
867  // below, so park it on TXW where the tick processor's inactivity timer recycles it,
868  // and let cycleTx pull the next pending transaction instead.
869  if (txn->m_state != TxnState::TXN_STATE_S1 && txn->m_state != TxnState::TXN_STATE_S2) {
870  this->dequeueTransaction(txn);
871  this->insertSortPrio(txn, QueueId::TXW);
872  m_engine->armInactTimer(txn);
873  return ret; // ran_one stays clear so cycleTx moves on to the next PEND entry
874  }
875 
876  // if no more messages, then chan->m_currentTxn will be set.
877  // If the transaction sent the last filedata PDU and EOF, it will move itself
878  // off the active queue. Run until either of these occur.
879  while (!this->m_currentTxn && txn->m_flags.com.q_index == QueueId::TXA) {
880  const U32 prevOutgoing = this->m_outgoingCounter;
881  const TxnState prevState = txn->m_state;
882  const TxSubState prevSubState = txn->m_state_data.send.sub_state;
883 
884  m_engine->dispatchTx(txn);
885 
886  // Every productive dispatch either sends a PDU, changes the transaction's state or
887  // sub-state, or satisfies an exit condition above. A dispatch that does none of these
888  // will do the same on every later iteration, so this loop would never exit. Fail the
889  // transaction instead: finishTransaction moves it to TXW, where the tick processor's
890  // inactivity timer recycles it and reports the failure.
891  if (!this->m_currentTxn && txn->m_flags.com.q_index == QueueId::TXA &&
892  this->m_outgoingCounter == prevOutgoing && txn->m_state == prevState &&
893  txn->m_state_data.send.sub_state == prevSubState) {
895  m_engine->finishTransaction(txn, true);
896  }
897  }
898 
899  args->ran_one = 1;
900  }
901 
902  return ret;
903 }
904 
906  CListTraverseStatus ret =
907  CLIST_TRAVERSE_CONTINUE; // CLIST_TRAVERSE_CONTINUE means don't tick one, keep looking for currentTxn
908  TickArgs* args = static_cast<TickArgs*>(context);
909  Transaction* txn = container_of_cpp(node, &Transaction::m_cl_node);
910  if (!this->m_currentTxn || (this->m_currentTxn == txn)) {
911  // found where we left off, so clear that and move on
912  this->m_currentTxn = nullptr;
913  if (!txn->m_flags.com.suspended) {
914  (txn->*args->fn)(&args->cont);
915  }
916 
917  // if this->m_currentTxn was set to not-nullptr above, then exit early
918  // NOTE: if channel is frozen, then tick processing won't have been entered.
919  // so there is no need to check it here
920  if (this->m_currentTxn) {
921  ret = CLIST_TRAVERSE_EXIT;
922  args->early_exit = true;
923  }
924  }
925 
926  return ret; // don't tick one, keep looking for currentTxn
927 }
928 
931  return &m_transactions[index];
932 }
933 
936  return &m_histories[index];
937 }
938 
939 // ----------------------------------------------------------------------
940 // Static callback wrapper implementations
941 // ----------------------------------------------------------------------
942 
944  struct CycleTxContext {
945  Channel* channel;
946  CycleTxArgs* args;
947  };
948  CycleTxContext* ctx = static_cast<CycleTxContext*>(context);
949  return ctx->channel->cycleTxFirstActive(node, ctx->args);
950 }
951 
953  struct TickContext {
954  Channel* channel;
955  TickArgs* args;
956  };
957  TickContext* ctx = static_cast<TickContext*>(context);
958  return ctx->channel->doTick(node, ctx->args);
959 }
960 
962  struct TraverseAllContext {
964  void* userContext;
965  I32* counter;
966  };
967  TraverseAllContext* ctx = static_cast<TraverseAllContext*>(context);
968  Transaction* txn = container_of_cpp(node, &Transaction::m_cl_node);
969  ctx->fn(txn, ctx->userContext);
970  ++(*ctx->counter);
972 }
973 
974 } // namespace Cfdp
975 } // namespace Ccsds
976 } // namespace Svc
CListNode cl_node
for connection to a CList
Definition: Types.hpp:246
U8 getPriority() const
Get transaction priority.
CfdpTxnFilenames fnames
file names associated with this history entry
Definition: Types.hpp:245
CFDP Protocol Engine.
Definition: Engine.hpp:90
void moveTransaction(Transaction *txn, QueueId::T queue)
Move a transaction from one queue to another.
Definition: Channel.cpp:539
Fw::String dstDir
path to destination dir
Definition: Types.hpp:309
CFDP Channel class.
Definition: Channel.hpp:56
virtual void * allocate(const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable, FwSizeType alignment=alignof(std::max_align_t))=0
Structure for use with the Channel::doTick() function.
Definition: Engine.hpp:71
~Channel()
Destruct a Channel.
Definition: Channel.cpp:169
TxnState
High-level state of a transaction.
Definition: Types.hpp:116
Argument structure for use with CfdpCListTraverseR()
Definition: Utils.hpp:73
Transaction * txn
output transaction pointer
Definition: Utils.hpp:54
History * getHistory(U32 index)
Get a history by index (for testing)
Definition: Channel.cpp:934
bool early_exit
early exit result
Definition: Engine.hpp:74
CFDP Transaction state machine class.
void log_WARNING_LO_PlaybackDestinationPathTooLong(FwSizeType length, FwSizeType maxLength, const Fw::StringBase &directory, const Fw::StringBase &entry) const
PlatformSizeType FwSizeType
void removeFromQueue(QueueId::T queueidx, CListNode *node)
Remove a node from a channel queue.
Definition: Channel.hpp:538
I32 FwEnumStoreType
CListTraverseStatus
Traverse status for circular list operations.
Definition: Clist.hpp:45
void(Transaction::* fn)(I32 *)
member function pointer
Definition: Engine.hpp:73
U16 num_ts
number of transactions
Definition: Types.hpp:282
void(*)(Transaction *txn, void *context) CfdpTraverseAllTransactionsFunc
Callback function type for use with Channel::traverseAllTransactions()
Definition: Types.hpp:421
void setCurrentTxn(const Transaction *txn)
Set current transaction.
Definition: Channel.cpp:716
State assigned to a newly allocated transaction object.
U32 EntityId
Entity id size.
first one on this list is active
void sTickNak(I32 *cont)
Perform NAK response for TX transactions.
I32 cont
if 1, then re-traverse the list
Definition: Engine.hpp:75
I32 traverseAllTransactions(CfdpTraverseAllTransactionsFunc fn, void *context)
Traverses all transactions on all active queues and performs an operation on them.
Definition: Channel.cpp:477
U8 priority
priority to use when placing transactions on the pending queue
Definition: Types.hpp:304
Wrapper around a CfdpChunkList object.
Definition: Types.hpp:260
void reset()
Reset the chunk list to empty state.
Definition: Chunk.cpp:58
Fw::StringTemplate< MaxFilePathSize > pending_file
Definition: Types.hpp:285
CfdpChunkList chunks
Chunk list for gap tracking.
Definition: Types.hpp:261
File will be deleted after the CFDP transaction.
Definition: KeepEnumAc.hpp:38
CFDP class 2 - Reliable transfer (Acknowledged)
Definition: ClassEnumAc.hpp:44
Channel * chan
channel object
Definition: Engine.hpp:64
static CListTraverseStatus prioritySearchCallback(CListNode *node, void *context)
Static callback for priority search.
Definition: Utils.cpp:89
Continue traversing the list.
Definition: Clist.hpp:46
void rTick(I32 *cont)
Perform tick (time-based) processing for R transactions.
void processPollingDirectories()
Process all polling directories for this channel.
Definition: Channel.cpp:353
U32 intervalSec
number of seconds to wait before trying a new directory
Definition: Types.hpp:302
CFDP Playback entry.
Definition: Types.hpp:278
I32 ran_one
should be set to 1 if a transaction was cycled
Definition: Engine.hpp:65
CListTraverseStatus cycleTxFirstActive(CListNode *node, void *context)
Traverse callback for cycling the first active transaction.
Definition: Channel.cpp:855
void finishTransaction(Transaction *txn, bool keep_history)
Finish a transaction.
Definition: Engine.cpp:1066
U32 TransactionSeq
transaction sequence number size
U8 getChannelId() const
Get channel ID.
Fw::Enabled getDequeueEnabledParam(U8 channelIndex)
bool keep_history
whether history should be preserved during recycle
Definition: Types.hpp:365
Status getStatus(void)
Get the status of a CFDP timer.
Definition: Timer.cpp:35
TxSubState
Sub-state of a send file transaction.
Definition: Types.hpp:131
static constexpr U32 CFDP_NUM_TRANSACTIONS_PER_CHANNEL
Maximum possible number of transactions that may exist on a single CFDP channel.
Definition: Types.hpp:42
void cycleTx()
Cycle the TX side of this channel.
Definition: Channel.cpp:213
#define CFDP_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION
TX chunks per transaction (per channel)
Definition: CfdpCfg.hpp:58
void decrementRxCounter()
Decrement the receive transaction counter for this channel.
Definition: Channel.cpp:704
static CListTraverseStatus cycleTxFirstActiveWrapper(CListNode *node, void *context)
Static wrapper for cycleTxFirstActive callback.
Definition: Channel.cpp:943
void close() override
Close directory.
Definition: Directory.cpp:74
Argument structure for use with CList_Traverse()
Definition: Utils.hpp:51
void insertAfterInQueue(QueueId::T queueidx, CListNode *start, CListNode *after)
Insert a node after another in a channel queue.
Definition: Channel.hpp:542
Structure for use with the Channel::cycleTx() function.
Definition: Engine.hpp:63
Status read(char *fileNameBuffer, FwSizeType buffSize) override
Get next filename from directory stream.
Definition: Directory.cpp:54
void armInactTimer(Transaction *txn)
Arm the inactivity timer for a transaction.
Definition: Engine.cpp:110
void reset()
Reset transaction to default state.
Channel(Engine *engine, U8 channelId, CfdpManager *cfdpManager, Fw::MemAllocator &allocator, FwEnumStoreType memId)
Construct a Channel.
Definition: Channel.cpp:51
void clearCurrentIfMatch(Transaction *txn)
Check if current transaction matches and clear if so.
Definition: Channel.cpp:709
void tickTransactions()
Tick all transactions on this channel.
Definition: Channel.cpp:269
Direction dir
direction of this history entry
Definition: Types.hpp:247
void freeTransaction(Transaction *txn)
Frees and resets a transaction and returns it for later use.
Definition: Channel.cpp:602
void dequeueTransaction(Transaction *txn)
Free a transaction from the queue it&#39;s on.
Definition: Channel.cpp:503
Playback pb
State of the current playback requests.
Definition: Types.hpp:299
void dispatchTx(Transaction *txn)
Dispatch TX state machine for a transaction.
Definition: Engine.cpp:174
void setTimer(U32 timerDuration)
Definition: Timer.cpp:25
void txFileInitiate(Transaction *txn, Class::T cfdp_class, Keep::T keep, U8 chan, U8 priority, EntityId dest_id)
Initiate a file transfer transaction.
Definition: Engine.cpp:817
void setTxnStatus(Transaction *txn, TxnStatus txn_stat)
Helper function to store transaction status code only.
Definition: Engine.cpp:1172
Stop traversing the list.
Definition: Clist.hpp:47
void close() override
close the file, if not opened then do nothing
Definition: File.cpp:97
Directory stream has no more files.
Definition: Directory.hpp:27
static CListTraverseStatus findBySequenceNumberCallback(CListNode *node, void *context)
Static callback for finding transaction by sequence number.
Definition: Utils.cpp:74
CfdpTxStateData send
applies to only send file transactions
Definition: Types.hpp:411
void CfdpCListTraverse(CListNode *start, CListFunc fn, void *context)
Traverse the entire list, calling the given function on all nodes.
Definition: Clist.cpp:139
Status::T playbackDirInitiate(Playback *pb, const Fw::String &src_filename, const Fw::String &dst_filename, Class::T cfdp_class, Keep::T keep, U8 chan, U8 priority, EntityId dest_id)
Initiate playback of a directory.
Definition: Engine.cpp:910
Fw::String srcDir
path to source dir
Definition: Types.hpp:308
CListNode * CfdpCListPop(CListNode **head)
Remove the first node from a list and return it.
Definition: Clist.cpp:89
void decrementCmdTxCounter()
Decrement the command TX counter for this channel.
Definition: Channel.cpp:699
void CfdpCListInsertBack(CListNode **head, CListNode *node)
Insert the given node into the back of a list.
Definition: Clist.cpp:69
Transaction * txn
OUT: holds value of transaction with which to call CfdpCListInsertAfter on.
Definition: Utils.hpp:74
static CListTraverseStatus doTickWrapper(CListNode *node, void *context)
Static wrapper for doTick callback.
Definition: Channel.cpp:952
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
void processPlaybackDirectories()
Process all playback directories for this channel.
Definition: Channel.cpp:336
void insertSortPrio(Transaction *txn, QueueId::T queue)
Insert a transaction into a priority sorted transaction queue.
Definition: Channel.cpp:668
void sTick(I32 *cont)
Perform tick (time-based) processing for S transactions.
CfdpTxnFilenames fnames
Definition: Types.hpp:281
Cfdp::ChannelTelemetry & getChannelTelemetryRef(U8 channelId)
Get reference to channel telemetry for Channel class.
Definition: Engine.cpp:1284
Transaction * findUnusedTransaction(Direction direction)
Find an unused transaction on this channel.
Definition: Channel.cpp:396
Class::T getClass() const
Get transaction class (CLASS_1 or CLASS_2)
TransactionSeq seq_num
transaction identifier, stays constant for entire transfer
Definition: Types.hpp:251
void cleanup(Fw::MemAllocator &allocator, FwEnumStoreType memId)
Clean up dynamically allocated resources.
Definition: Channel.cpp:174
Memory Allocation base class.
void log_WARNING_LO_PlaybackDirReadFailed(const Fw::StringBase &directory, I32 status) const
Log event PlaybackDirReadFailed.
Transaction * getTransaction(U32 index)
Get a transaction by index (for testing)
Definition: Channel.cpp:929
void insertBackInQueue(QueueId::T queueidx, CListNode *node)
Insert a node at the back of a channel queue.
Definition: Channel.hpp:546
Class::T cfdpClass
the CFDP class to send
Definition: Types.hpp:305
constexpr Container * container_of_cpp(Member *member_ptr, Member Container::*member)
Obtains a pointer to the parent structure.
Definition: Clist.hpp:79
void CfdpCListRemove(CListNode **head, CListNode *node)
Remove the given node from the list.
Definition: Clist.cpp:102
Operation was successful.
Definition: Directory.hpp:22
void run(void)
Runs a one second increment of the CFDP timers.
Definition: Timer.cpp:39
Fw::Enabled enabled
Enabled flag.
Definition: Types.hpp:311
CListTraverseStatus doTick(CListNode *node, void *context)
Traverse callback for ticking a transaction.
Definition: Channel.cpp:905
Circular linked list node structure.
Definition: Clist.hpp:66
Transaction * findTransactionBySequenceNumber(TransactionSeq transaction_sequence_number, EntityId src_eid)
Finds an active transaction by sequence number.
Definition: Channel.cpp:457
Timer intervalTimer
Timer object used to poll the directory.
Definition: Types.hpp:300
Structure for the telemetry array of CFDP channels.
RateGroupDivider component implementation.
virtual SizeType length() const
Get the length of the string.
CfdpFlagsCommon com
applies to all transactions
Definition: Types.hpp:402
TxnStatus txn_stat
final status of operation
Definition: Types.hpp:248
void resetHistory(History *history)
Returns a history structure back to its unused state.
Definition: Channel.cpp:494
EntityId src_eid
the source eid of the transaction
Definition: Types.hpp:249
void log_WARNING_LO_DanglingFileHandleClosed(U8 channelId, U32 transactionSeq) const
Log event DanglingFileHandleClosed.
virtual void deallocate(const FwEnumStoreType identifier, void *ptr)=0
#define CFDP_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION
RX chunks per transaction (per channel)
Definition: CfdpCfg.hpp:37
Directory poll entry.
Definition: Types.hpp:298
EntityId destEid
destination entity id
Definition: Types.hpp:306
U8 q_index
Q index this is in.
Definition: Types.hpp:359
void CfdpCListTraverseR(CListNode *end, CListFunc fn, void *context)
Reverse list traversal, starting from end, calling given function on all nodes.
Definition: Clist.cpp:173
CListNode ** getChunkListHead(U8 direction)
Gets the head of the chunk list for this channel + direction.
Definition: Channel.cpp:724
CfdpChunkWrapper * findUnusedChunks(Direction dir)
Find unused chunks for this channel.
Definition: Channel.cpp:736
void log_WARNING_LO_PlaybackSourcePathTooLong(FwSizeType length, FwSizeType maxLength, const Fw::StringBase &directory, const Fw::StringBase &entry) const
T
The raw enum type.
void recycleTransaction(Transaction *txn)
Recover resources associated with a transaction.
Definition: Channel.cpp:620
Direction
Direction identifier.
Definition: Types.hpp:154
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Disabled state.
bool isOpen() const
determine if the file is open
Definition: File.cpp:105
CListNode cl_node
Circular list node for pooling.
Definition: Types.hpp:262
static CListTraverseStatus traverseAllTransactionsWrapper(CListNode *node, void *context)
Static wrapper for traverseAllTransactions callback.
Definition: Channel.cpp:961
Pairs an offset with a size to identify a specific piece of a file.
Definition: Chunk.hpp:49
EntityId peer_eid
peer_eid is always the "other guy", same src_eid for RX
Definition: Types.hpp:250
void CfdpCListInitNode(CListNode *node)
Initialize a clist node.
Definition: Clist.cpp:43
CFDP History entry.
Definition: Types.hpp:244