Truxton message get route id

From truxwiki.com
Jump to navigation Jump to search

Tells you the route this media is taking through the exploitation process. This corresponds to the [ID] column of the [LoadConfiguration] table.

Syntax

uint32_t truxton_message_get_route_id( uint64_t message_handle );

Parameters

message_handle

The handle to a message created by the truxton_message_create call.

Return value

The identifier of the type of load being performed.

Sample

void dump_route( uint64_t message )
{
   uint32_t id = truxton_message_get_route_id( message );

   if ( id == 0 )
   {
      printf( "Performing a default load.\n" );
   }
   else if ( id == 4 )
   {
      printf( "Performing a triage load.\n" );
   }
   else if ( id == 5 )
   {
      printf( "Data recovery load.\n" );
   }
   else
   {
      printf( "Some load with an id of %" PRIu32 "\n", id );
   }
}

The PRIu32 in the sample code above is a standard way of formatting a 32-bit unsigned integer in C. Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.