Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Runtime #9

Open
mempler opened this issue Sep 2, 2023 · 1 comment
Open

Application Runtime #9

mempler opened this issue Sep 2, 2023 · 1 comment
Assignees
Labels

Comments

@mempler
Copy link
Member

mempler commented Sep 2, 2023

Protocol Stack

In the C-based code provided, a PROTOCOL_STACK acts as a common ground for the host and application for sharing data. This is particularly useful for configuring another application based on the data provided.

Struct: PROTOCOL

struct PROTOCOL
{
    GUID   Guid;
    UINT16 Revision;
    UINT8  DataFlags;
    UINT8  Reserved;
    UINT32 DataLength;
    CHAR8  Data[0];
};

Each protocol is identified by a unique guideline identifier GUID.

The Revision value ensures that each new version of a protocol is backward compatible.

DataFlags is used to set specific flags for the data.

The Reserved value is kept for future use and must be 0.

The DataLength field is the length of data payload followed by the actual Data.

Struct: PROTOCOL_STACK

struct PROTOCOL_STACK
{
    UINTN Count;
    CHAR8 Protocols[0];
};

The PROTOCOL_STACK holds the count and list of protocols the host has provided to the application.

API Prototypes

Several utility functions are provided for work with protocol stack:

  • PrintProtocolStack: Prints the protocol stack.
  • IterateProtocolStack: Iteratively accesses each protocol within the stack.
  • GetProtocol: Retrieves a specific protocol based on the given GUID.
  • GetProtocolData: Retrieves the data of a specific protocol based on the given GUID.

Implementation Use

The protocol stack is being used in the main function as a means to facilitate data synchronization between the host and the application. Three protocols are defined:

  • COMMAND_LINE_PROTOCOL_GUID: This Protocol captures the command line arguments.
  • ENVIRONMENT_VARIABLE_PROTOCOL_GUID: This Protocol captures the environment variables.
  • APPLICATION_IMAGE_PROTOCOL_GUID: This protocol holds information about the image of the application.

The Protocols are iteratively added to the Protocol stack in the main implementation. The data for each Protocol is then accessed, interpreted and used based on its GUID.

image

Future Utilization

The PROTOCOL structure has a reserved field which might be used for an additional layer of functionality or information in the future. As the protocol and its stack revolves around the host-application data transfer architecture, its future would highly depend on how such an architecture evolves. It can be extended to incorporate new types of data communication paradigms or configurations as the communication needs between application and host evolve.

@mempler mempler self-assigned this Sep 2, 2023
@mempler
Copy link
Member Author

mempler commented Sep 2, 2023

Application Runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant