51 a_value->
bytes = (guchar *) g_malloc0(length *
sizeof(guchar));
53 memcpy(a_value->
bytes, bin_data, length);
64 treatment_t *new_tment = NULL;
66 new_tment = (treatment_t *) g_malloc0(
sizeof(treatment_t));
70 if (tment->name != NULL)
72 new_tment->name = g_strdup(tment->name);
76 new_tment->name = NULL;
78 new_tment->do_it = tment->do_it;
79 new_tment->init = tment->init;
80 new_tment->kill = tment->kill;
81 new_tment->copy = tment->copy;
83 if (tment->copy != NULL)
85 new_tment->data = tment->copy(tment->data);
102 treatment_t *tment = NULL;
104 while (tment_list != NULL)
106 tment = (treatment_t *) tment_list->data;
107 if (g_ascii_strcasecmp(tment->name, tment_name) == 0)
113 tment_list = g_list_next(tment_list);
126 treatment_t *new_tment = NULL;
130 new_tment = (treatment_t *) g_malloc0(
sizeof(treatment_t));
131 new_tment->name = g_strdup(
"reverse");
136 list = g_list_prepend(list, new_tment);
148 treatment_t *tment = (treatment_t *) data;
163 treatment_t *tment = (treatment_t *) data;
191 guchar *reversed = NULL;
196 while (values_list != NULL)
199 extracted = (
value_t *) values_list->data;
200 reversed = (guchar *) g_malloc0(
sizeof(guchar) * extracted->
length);
202 for (i=0; i<extracted->
length; i++)
204 reversed[i] = extracted->
bytes[extracted->
length-1-i];
206 g_free(extracted->
bytes);
207 extracted->
bytes = reversed;
209 values_list = g_list_next(values_list);
GList * init_treatments(void)
Here we do init the available treatment list Should only be called once at init time.
static gpointer treatment_reverse_copy(gpointer data)
Copy treatment's datas.
static void treatment_reverse_kill(gpointer data)
Deletes treatment (itself)
treatment_t * find_treatment(GList *tment_list, gchar *tment_name)
Finds a treatment, by name, in the treatment list returns the treatment if found, NULL otherwise...
static void treatment_reverse_init(gpointer data)
Treatment initialisation (called at runtime when selected by the user)
treatment_t * copy_treatment(treatment_t *tment)
Copies the treatment and calls the treatment copy function that copies the data of the treatment itse...
static GList * treatment_reverse_do_it(GList *gchar_list)
General background : Each treatment has to provide 4 functions :
value_t * new_value_t(guint length, guchar *bin_data)
This file contains all the definitions and includes all other .h files.