Difference between revisions of "Truxton url get method"
Jump to navigation
Jump to search
(Created page with "This retrieves the offset into the parent file of where the account was found. This corresponds to the <code>[WebsiteMethodID]</code> column of the <code><nowiki>[</nowiki>W...") |
(→Sample) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | This retrieves the | + | This retrieves the method used to retrieve the URL. |
This corresponds to the <code>[WebsiteMethodID]</code> column of the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table. | This corresponds to the <code>[WebsiteMethodID]</code> column of the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table. | ||
| Line 10: | Line 10: | ||
==<code>url_handle</code>== | ==<code>url_handle</code>== | ||
This handle comes from calling <code>[[truxton_url_create]]()</code>, or <code>[[truxton_file_create_url]]()</code>. | This handle comes from calling <code>[[truxton_url_create]]()</code>, or <code>[[truxton_file_create_url]]()</code>. | ||
| + | |||
| + | =Return value= | ||
| + | The method the URL was retrieved as stored in the <code>[WebsiteMethodID]</code> column of the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table. | ||
| + | It should also be one of the [[URL Methods|defined constant]] values. | ||
=Sample= | =Sample= | ||
<source lang="C" highlight="44"> | <source lang="C" highlight="44"> | ||
| − | void dump_url(uint64_t url_handle) | + | void dump_url( uint64_t url_handle ) |
{ | { | ||
uint64_t integer_value = 0; | uint64_t integer_value = 0; | ||
| Line 66: | Line 70: | ||
} | } | ||
</source> | </source> | ||
| + | |||
| + | The <code>PRIu64</code> in the sample code above is a standard way of [https://en.wikipedia.org/wiki/C_data_types#Printf_and_scanf_format_specifiers formatting] a 64-bit unsigned integer in C. | ||
| + | Over the years, different compilers on different operating systems used different format specifiers for things, these <code>PRI</code> 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. | ||
Latest revision as of 07:14, 6 February 2021
This retrieves the method used to retrieve the URL.
This corresponds to the [WebsiteMethodID] column of the [WebsiteVisit] table.
Syntax
uint64_t truxton_url_get_method( uint64_t url_handle );
Parameters
url_handle
This handle comes from calling truxton_url_create(), or truxton_file_create_url().
Return value
The method the URL was retrieved as stored in the [WebsiteMethodID] column of the [WebsiteVisit] table.
It should also be one of the defined constant values.
Sample
void dump_url( uint64_t url_handle )
{
uint64_t integer_value = 0;
char temp_string[ 1024 ];
truxton_url_get_id( url_handle, temp_string, sizeof(temp_string) );
printf( "URL ID is %s\n", temp_string );
truxton_url_get_media_id( url_handle, temp_string, sizeof(temp_string) );
printf( "Media ID is %s\n", temp_string );
truxton_url_get_file_id( url_handle, temp_string, sizeof(temp_string) );
printf( "File ID is %s\n", temp_string );
truxton_url_get_account( url_handle, temp_string, sizeof(temp_string) );
printf( "Account is \"%s\"\n", temp_string );
integer_value = truxton_url_get_account_offset( url_handle );
if ( integer_value == 0xFFFFFFFFFFFFFFFF )
{
printf( "Account offset is not known\n" );
}
else
{
printf( "Account offset is %" PRIu64 "\n", integer_value );
}
integer_value = truxton_url_get_url_offset( url_handle );
if ( integer_value == 0xFFFFFFFFFFFFFFFF )
{
printf( "URL offset is not known, probably came from a SQLite database\n" );
}
else
{
printf( "URL offset is %" PRIu64 "\n", integer_value );
}
integer_value = truxton_url_get_format( url_handle );
printf( "Format is %" PRIu64 "\n", integer_value );
integer_value = truxton_url_get_method( url_handle );
printf( "Method is %" PRIu64 "\n", integer_value );
integer_value = truxton_url_get_type( url_handle );
printf( "Type is %" PRIu64 "\n", integer_value );
integer_value = truxton_url_get_when( url_handle );
printf( "When is %" PRIu64 "\n", integer_value );
}
The PRIu64 in the sample code above is a standard way of formatting a 64-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.