Changes

Jump to navigation Jump to search
160 bytes added ,  13:50, 25 November 2016
Line 7: Line 7:  
== Writing parasite code ==
 
== Writing parasite code ==
   −
Execution of the parasite code starts with the function
+
Execution of parasite code always starts with a function in compel std plugin that should be linked with parasite binary (see below). From the parasite code these symbols should be available for libcompel to work
   −
<source lang="C">
+
; parasite_trap_cmd(int cmd, void *arg);
int main(void *arg_p, unsigned int arg_s);
+
: This routine gets called by <code>compel_run_in_thread()</code>
</source>
     −
that should be present in your code. The <code>arg_p</code> and <code>arg_s</code> is the binary argument that will get delivered to parasite code by complel <code>_start()</code> call (see below). Sometimes this binary argument can be treated as CLI arguments argc/argv.
+
; parasite_daemon_cmd(int cmd, void *arg);
 +
: This routine gets called by <code>compel_rpc_call()</code> and <code>compel_rpc_call_sync()</code>
 +
 
 +
; parasite_cleanup(void);
 +
: This gets called on parasite unload by <code>compel_cure()</code>
    
== Compiling and packing ==
 
== Compiling and packing ==

Navigation menu