Skip to content

Commit

Permalink
adding Spacecraft ID to SBN peers and making tables reloadable
Browse files Browse the repository at this point in the history
  • Loading branch information
jbohren-hbr committed Feb 9, 2021
1 parent cd9b4c7 commit 9bd0d7a
Show file tree
Hide file tree
Showing 10 changed files with 643 additions and 216 deletions.
20 changes: 13 additions & 7 deletions fsw/platform_inc/sbn_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct SBN_PeerInterface_s SBN_PeerInterface_t;
* SBN headers are MsgSz + MsgType + ProcessorID
* SBN subscription messages are MsgID + QoS
*/
#define SBN_PACKED_HDR_SZ (sizeof(SBN_MsgSz_t) + sizeof(SBN_MsgType_t) + sizeof(CFE_ProcessorID_t))
#define SBN_PACKED_HDR_SZ (sizeof(SBN_MsgSz_t) + sizeof(SBN_MsgType_t) + sizeof(CFE_ProcessorID_t) + sizeof(CFE_SpacecraftID_t))
#define SBN_PACKED_SUB_SZ \
(SBN_PACKED_HDR_SZ + sizeof(SBN_SubCnt_t) + (sizeof(CFE_SB_MsgId_t) + sizeof(CFE_SB_Qos_t)) * SBN_MAX_SUBS_PER_PEER)
#define SBN_MAX_PACKED_MSG_SZ (SBN_PACKED_HDR_SZ + CFE_MISSION_SB_MAX_SB_MSG_SIZE)
Expand Down Expand Up @@ -200,27 +200,30 @@ typedef struct
* @param MsgSz[in] The size of the Msg parameter.
* @param MsgType[in] The type of the Msg (app, sub/unsub, heartbeat, announce).
* @param ProcessorID[in] The Processor ID of the sender (should be CFE_CPU_ID)
* @param SpacecraftID[in] The Spacecraft ID of the sender
* @param Msg[in] The SBN message payload (CCSDS message, sub/unsub)
*
* @sa UnpackMsg
*/
void (*PackMsg)(void *SBNMsgBuf, SBN_MsgSz_t MsgSz, SBN_MsgType_t MsgType, CFE_ProcessorID_t ProcessorID, void *Msg);
void (*PackMsg)(void *SBNMsgBuf, SBN_MsgSz_t MsgSz, SBN_MsgType_t MsgType, CFE_ProcessorID_t ProcessorID,
CFE_SpacecraftID_t SpacecraftID, void *Msg);

/**
* @brief Used by modules to unpack messages received.
*
* @param SBNMsgBuf[in] The buffer pointer containing the SBN message.
* @param MsgSzPtr[out] The size of the Msg parameter.
* @param MsgTypePtr[out] The type of the Msg (app, sub/unsub, heartbeat, announce).
* @param ProcessorID[out] The Processor ID of the sender (should be CFE_CPU_ID)
* @param ProcessorIDPtr[out] The Processor ID of the sender (should be CFE_CPU_ID)
* @param SpacecraftIDPtr[out] The Spacecraft ID of the sender
* @param Msg[out] The SBN message payload (CCSDS message, sub/unsub, ensure it is at least
* CFE_MISSION_SB_MAX_SB_MSG_SIZE)
* @return TRUE if we were unable to unpack/verify the message.
*
* @sa PackMsg
*/
bool (*UnpackMsg)(void *SBNBuf, SBN_MsgSz_t *MsgSzPtr, SBN_MsgType_t *MsgTypePtr, CFE_ProcessorID_t *ProcessorIDPtr,
void *Msg);
CFE_SpacecraftID_t *SpacecraftIDPtr, void *Msg);

/**
* Called by backend modules to signal that the connection has been
Expand Down Expand Up @@ -259,10 +262,11 @@ typedef struct
*
* @param Net[in] The network to check.
* @param ProcessorID[in] The processor of the peer.
* @param SpacecraftID[in] The spacecraft of the peer.
*
* @return A pointer to the peer interface structure.
*/
SBN_PeerInterface_t *(*GetPeer)(SBN_NetInterface_t *Net, CFE_ProcessorID_t ProcessorID);
SBN_PeerInterface_t *(*GetPeer)(SBN_NetInterface_t *Net, CFE_ProcessorID_t ProcessorID, CFE_SpacecraftID_t SpacecraftID);
} SBN_ProtocolOutlet_t;

/**
Expand Down Expand Up @@ -360,13 +364,14 @@ struct SBN_IfOps_s
* @param MsgTypePtr[out] SBN message type received.
* @param MsgSzPtr[out] Payload size received.
* @param ProcessorIDPtr[out] ProcessorID of the sender.
* @param SpacecraftIDPtr[out] SpacecraftID of the sender.
* @param PayloadBuffer[out] Payload buffer
* (pass in a buffer of CFE_MISSION_SB_MAX_SB_MSG_SIZE)
*
* @return SBN_SUCCESS on success, SBN_ERROR on failure
*/
SBN_Status_t (*RecvFromPeer)(SBN_NetInterface_t *Net, SBN_PeerInterface_t *Peer, SBN_MsgType_t *MsgTypePtr,
SBN_MsgSz_t *MsgSzPtr, CFE_ProcessorID_t *ProcessorIDPtr, void *PayloadBuffer);
SBN_MsgSz_t *MsgSzPtr, CFE_ProcessorID_t *ProcessorIDPtr, CFE_SpacecraftID_t *SpacecraftIDPtr, void *PayloadBuffer);

/**
* Receives an individual message from the network.
Expand All @@ -375,13 +380,14 @@ struct SBN_IfOps_s
* @param MsgTypePtr[out] SBN message type received.
* @param MsgSzPtr[out] Payload size received.
* @param ProcessorIDPtr[out] ProcessorID of the sender.
* @param SpacecraftIDPtr[out] SpacecraftID of the sender.
* @param PayloadBuffer[out] Payload buffer
* (pass in a buffer of CFE_MISSION_SB_MAX_SB_MSG_SIZE)
*
* @return SBN_SUCCESS on success, SBN_ERROR on failure
*/
SBN_Status_t (*RecvFromNet)(SBN_NetInterface_t *Net, SBN_MsgType_t *MsgTypePtr, SBN_MsgSz_t *MsgSzPtr,
CFE_ProcessorID_t *ProcessorIDPtr, void *PayloadBuffer);
CFE_ProcessorID_t *ProcessorIDPtr, CFE_SpacecraftID_t *SpacecraftIDPtr, void *PayloadBuffer);

/**
* Unload a network. This will unload all associated peers as well.
Expand Down
Loading

0 comments on commit 9bd0d7a

Please sign in to comment.