Studio:SCL Message Attributes: Difference between revisions
(New page: 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 inc...) |
m (Text replace - 'Category: Messages' to 'Category:Studio:Messages') |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__TOC__ | |||
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 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_Attributes_.28MT.29|Message Type (MT)]] | ||
* | * [[#Send_Type_for_Command_.28STc.29|Send Type for Command (STc)]] | ||
* | * [[#Send_Type_for_Response_.28STr.29|Send Type for Response (STr)]] | ||
* | * [[#Pointer_Usage_for_Command_.28PUc.29|Pointer Usage for Command (PUc)]] | ||
* | * [[#Pointer_Usage_for_Response_.28PUr.29|Pointer Usage for Response (PUr)]] | ||
* Access Class (AC) | * [[#Access_Class_.28AC.29|Access Class (AC)]] | ||
Message attributes are represented by constants defined in the sr.h file. | Message attributes are represented by constants defined in the sr.h file. | ||
Line 34: | Line 36: | ||
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. | 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)=== | |||
{| border="1" cellspacing="0" cellpadding="10" style="align:left;" | {| border="1" cellspacing="0" cellpadding="10" style="align:left;" | ||
| '''Command Send Types (STc)''' | | '''Command Send Types (STc)''' | ||
Line 45: | Line 48: | ||
|} | |} | ||
===Send Type for Response (STr)=== | |||
{| border="1" cellspacing="0" cellpadding="10" style="align:left;" | {| border="1" cellspacing="0" cellpadding="10" style="align:left;" | ||
| '''Response Send Types (STr)''' | | '''Response Send Types (STr)''' | ||
Line 61: | Line 64: | ||
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. | 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)=== | |||
{| border="1" cellspacing="0" cellpadding="10" style="align:left;" | {| border="1" cellspacing="0" cellpadding="10" style="align:left;" | ||
| '''Pointer Usage for Command (PUc)''' | | '''Pointer Usage for Command (PUc)''' | ||
Line 72: | Line 76: | ||
|} | |} | ||
===Pointer Usage for Response (PUr)=== | |||
{| border="1" cellspacing="0" cellpadding="10" style="align:left;" | {| border="1" cellspacing="0" cellpadding="10" style="align:left;" | ||
| '''Pointer Usage for | | '''Pointer Usage for Response (PUr)''' | ||
| '''Attribute Constant''' | | '''Attribute Constant''' | ||
|- | |- | ||
Line 82: | Line 86: | ||
| Response Using Pool Memory | | Response Using Pool Memory | ||
| srPU_RSP_POL | | srPU_RSP_POL | ||
|} | |} | ||
== Access Class == | == Access Class == | ||
Line 101: | Line 104: | ||
| srAC_SYS | | srAC_SYS | ||
|} | |} | ||
== Message Attribute Examples == | == Message Attribute Examples == | ||
<source lang=c> | |||
/* 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 | |||
</source> | |||
== See Also == | |||
* [[SCL_Structure|SCL Structure]] | |||
* [[SCL_Data_Types|SCL Data Types]] | |||
* [[SCL_Pragmas|SCL Pragmas]] | |||
[[Category:Studio:Messages]] | |||
[[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