Difference between revisions of "Truxton group create"

From truxwiki.com
Jump to navigation Jump to search
 
Line 3: Line 3:
 
=Syntax=
 
=Syntax=
 
<source lang="C">
 
<source lang="C">
uint64_t truxton_investigation_create_group( uint64_t investigation_handle );
+
uint64_t truxton_group_create( uint64_t truxton_handle );
 
</source>
 
</source>
  
 
=Parameters=
 
=Parameters=
==<code>investigation_handle </code>==
+
==<code>truxton_handle</code>==
The investigation that will own the group.
+
The Truxton instance this group will belong.
This handle comes from calling <code>[[truxton_investigation_create]]()</code>.
+
This handle comes from calling <code>[[truxton_create]]()</code>.
  
 
=Return value=
 
=Return value=
A non zero value on success, zero on failure.
+
A handle to the group object on success, zero on failure.
  
 
=Sample=
 
=Sample=
Line 24: Line 24:
  
 
     uint64_t truxton_handle = truxton_investigation_get_truxton( investigation_handle );
 
     uint64_t truxton_handle = truxton_investigation_get_truxton( investigation_handle );
     uint64_t group_handle = truxton_investigation_create_group( truxton_handle );
+
     uint64_t group_handle = truxton_group_create( truxton_handle );
 
   
 
   
     truxton_group_set_name(group_handle, "My Things");
+
     truxton_group_set_name( group_handle, "My Things" );
     truxton_group_set_description(group_handle, "These are my things");
+
     truxton_group_set_description( group_handle, "These are my things" );
     truxton_group_set_is_default(group_handle, 1);
+
     truxton_group_set_is_default( group_handle, 1 );
     truxton_group_set_type(group_handle, GROUP_TYPE_USER);
+
     truxton_group_set_type( group_handle, GROUP_TYPE_USER );
  
     if (truxton_group_save(group_handle) != 0)
+
     if ( truxton_group_save( group_handle ) != 0 )
 
     {
 
     {
 
         char guid[MINIMUM_GUID_STRING_BUFFER_SIZE + 5];
 
         char guid[MINIMUM_GUID_STRING_BUFFER_SIZE + 5];
  
         truxton_group_get_id(group_handle, guid, sizeof(guid));
+
         truxton_group_get_id( group_handle, guid, sizeof(guid) );
         truxton_investigation_set_active_group_id(investigation_handle, guid);
+
         truxton_investigation_set_active_group_id( investigation_handle, guid );
 
     }
 
     }
 +
 +
    truxton_group_destroy( group_handle );
 
}
 
}
 
</source>
 
</source>

Latest revision as of 05:17, 25 May 2023

This creates a group in Truxton.

Syntax

uint64_t truxton_group_create( uint64_t truxton_handle );

Parameters

truxton_handle

The Truxton instance this group will belong. This handle comes from calling truxton_create().

Return value

A handle to the group object on success, zero on failure.

Sample

void create_my_things(uint64_t investigation_handle)
{
    if (investigation_handle == 0)
    {
        return;
    }

    uint64_t truxton_handle = truxton_investigation_get_truxton( investigation_handle );
    uint64_t group_handle = truxton_group_create( truxton_handle );
 
    truxton_group_set_name( group_handle, "My Things" );
    truxton_group_set_description( group_handle, "These are my things" );
    truxton_group_set_is_default( group_handle, 1 );
    truxton_group_set_type( group_handle, GROUP_TYPE_USER );

    if ( truxton_group_save( group_handle ) != 0 )
    {
        char guid[MINIMUM_GUID_STRING_BUFFER_SIZE + 5];

        truxton_group_get_id( group_handle, guid, sizeof(guid) );
        truxton_investigation_set_active_group_id( investigation_handle, guid );
    }

    truxton_group_destroy( group_handle );
}