+
+int *lookup_tid_list(int tid)
+{
+ if (!tid_filter_list)
+ return NULL;
+
+ return g_hash_table_lookup(tid_filter_list, (gpointer) &tid);
+}
+
+struct host *lookup_hostname_list(const char *hostname)
+{
+ if (!hostname || !global_host_list)
+ return NULL;
+
+ return g_hash_table_lookup(global_host_list, (gpointer) hostname);
+}
+
+int is_hostname_filtered(const char *hostname)
+{
+ struct host *host;
+
+ host = lookup_hostname_list(hostname);
+ if (host)
+ return host->filter;
+ return 0;
+}
+
+int *lookup_filter_tid_list(int tid)
+{
+ return g_hash_table_lookup(global_filter_list, (gpointer) &tid);
+}
+
+void add_filter_tid_list(struct processtop *proc)
+{
+ unsigned long *hash_tid;
+
+ hash_tid = malloc(sizeof(unsigned long));
+ *hash_tid = proc->tid;
+ g_hash_table_insert(global_filter_list,
+ (gpointer) (unsigned long) hash_tid, proc);
+}
+
+void remove_filter_tid_list(int tid)
+{
+ g_hash_table_remove(global_filter_list,
+ (gpointer) (unsigned long) &tid);
+}
+
+struct host *add_hostname_list(char *hostname, int filter)
+{
+ struct host *host;
+
+ host = lookup_hostname_list(hostname);
+ if (host)
+ return host;
+
+ host = g_new0(struct host, 1);
+ host->hostname = strdup(hostname);
+ host->filter = filter;
+ g_hash_table_insert(global_host_list,
+ (gpointer) host->hostname,
+ (gpointer) host);
+
+ return host;
+}
+
+void update_hostname_filter(struct host *host)
+{
+ struct processtop *tmp;
+ int i;
+
+ for (i = 0; i < lttngtop.process_table->len; i++) {
+ tmp = g_ptr_array_index(lttngtop.process_table, i);
+ if (tmp->host == host) {
+ if (host->filter)
+ add_filter_tid_list(tmp);
+ else
+ remove_filter_tid_list(tmp->tid);
+ }
+ }
+}