Studio:SCL Message Attributes: Difference between revisions
m (Text replace - 'Category: Messages' to 'Category:Studio:Messages') |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 132: | Line 132: | ||
* [[SCL_Pragmas|SCL Pragmas]] | * [[SCL_Pragmas|SCL Pragmas]] | ||
[[Category: Messages]] | [[Category:Studio:Messages]] | ||
[[Category: SCL]] | [[Category:Studio:SCL]] |
Latest revision as of 00:44, 21 August 2009
Message attributes are used to declare the message type, describe how to send the optional payload and indicate, if applicable, the pointer memory usage for the payload. The attributes include:
- Message Type (MT)
- Send Type for Command (STc)
- Send Type for Response (STr)
- Pointer Usage for Command (PUc)
- Pointer Usage for Response (PUr)
- Access Class (AC)
Message attributes are represented by constants defined in the sr.h file.
Message Type Attributes (MT)
The Message Type attribute defines the type of message being used for communication between the owner and the user. The attribute constants used for the different message types include:
Message Type (MT) | Attribute Constant |
One-way Command | srMT_ONE_CMD (or srMT_ONE or srMT_ONEc) |
One-way Response | srMT_ONE_RSP (or srMT_ONEr) |
Two-way Command Response | srMT_TWO |
Broadcast Response | srMT_BRD |
Send Type Attributes (ST)
The Send Type attribute is used to indicate how to transmit the payload. There are two ways to send a payload: By Value, or By Pointer. STRIDE Runtime is required to use this attribute when determining whether to route locally or remotely across platform boundaries. The No Payload attribute is used if there is no payload associated with the message. The following tables show the different ST attribute constants.
Send Type for Command (STc)
Command Send Types (STc) | Attribute Constant |
Command Payload by Value | srST_CMD_VAL |
Command Payload by Pointer | srST_CMD_PTR |
Send Type for Response (STr)
Response Send Types (STr) | Attribute Constant |
Response Payload by Value | srST_RSP_VAL |
Response Payload by Pointer | srST_RSP_PTR |
Pointer Usage Attributes (PU)
When a payload is passed by pointer, a Pointer Usage (PU) attribute is required. The PU attribute indicates if the payload is using pool memory or private memory. When the PU attribute indicates the payload is using pool memory, the SCM requires that the memory be allocated from the common pool being used by the system. Once the reader has processed the payload, releasing the memory is required. When the PU attribute indicates the payload is using private memory, the runtime environment makes no assumptions on how the payload memory is managed between the User and Owner when they are executing on the same Target platform. If the payload crosses platform boundaries, STRIDE Runtime is required to dynamically allocate memory from the common pool. The temporary memory that is allocated is used to hold the payload, and the address of the memory is passed to the reader. Once the reader returns the message memory to STRIDE Runtime, the temporary memory is automatically released. The original memory from the sender is not affected or synchronized with the other platform. Figure 5 and Figure 6 list the different PU attributes. The PU attribute is only applicable for payloads being sent by pointer.
Pointer Usage for Command (PUc)
Pointer Usage for Command (PUc) | Attribute Constant |
Command Using Private Memory | srPU_CMD_PRI |
Command Using Pool Memory | srPU_CMD_POL |
Pointer Usage for Response (PUr)
Pointer Usage for Response (PUr) | Attribute Constant |
Response Using Private Memory | srPU_RSP_PRI |
Response Using Pool Memory | srPU_RSP_POL |
Access Class
The Access Class (AC) attribute ensures that the intercept module will not register each SUID, and function calls with no registered owner will be routed to the intercept module STID.
Access Class (AC) | Attribute Constant |
Message | srAC_MSG |
Function | srAC_FUNCTION |
System/Application | srAC_SYS |
Message Attribute Examples
/* Include Attribute definitions */
#include <sr.h>
/* One-way Command - command payload sent by value */
#define OneWayCmdVal 1 | srMT_ONEc | srST_CMD_VAL
/* One-way Command - command payload sent by pointer using private memory */
#define OneWayCmdPtr 2 | srMT_ONEc | srST_CMD_PTR | srPU_CMD_PRI
/* One-way Response - response payload sent by value */
#define OneWayRspVal 3 | srMT_ONEr | srST_RSP_VAL
/* Two-way Command Response - command and response payloads sent by value */
#define TwoWayMsg 4 | srMT_TWO | srST_CMD_VAL | srST_RSP_VAL
/* Broadcast Response - response payload sent by pointer using pool memory */
#define Broadcast 5 | srMT_BRD | srST_RSP_PTR | srPU_RSP_POL