## GUPnPWhiteList GUPnPWhiteList — Class for network filtering. |

## Synopsis

    struct              GUPnPWhiteList;
    gboolean            gupnp_white_list_add_entry          (GUPnPWhiteList *white_list,
                                                             gchar *entry);
    void                gupnp_white_list_add_entryv         (GUPnPWhiteList *white_list,
                                                             gchar **entries);
    gboolean            gupnp_white_list_check_context      (GUPnPWhiteList *white_list,
                                                             GUPnPContext *context);
    void                gupnp_white_list_clear              (GUPnPWhiteList *white_list);
    void                gupnp_white_list_set_enabled        (GUPnPWhiteList *white_list,
                                                             gboolean enable);
    GList *             gupnp_white_list_get_entries        (GUPnPWhiteList *white_list);
    gboolean            gupnp_white_list_is_empty           (GUPnPWhiteList *white_list);
    gboolean            gupnp_white_list_get_enabled        (GUPnPWhiteList *white_list);
    GUPnPWhiteList *    gupnp_white_list_new                (void);
    gboolean            gupnp_white_list_remove_entry       (GUPnPWhiteList *white_list,
                                                             gchar *entry);

## Object Hierarchy

      GObject
       +----GUPnPWhiteList

## Description

GUPnPWhiteList handles network filtering. It provides API to manage a list of entries that will be used to filter networks. The GUPnPWhiteList could be enabled or not. If it's enabled but the entries list is empty, it behaves as disabled.

## Details

### struct GUPnPWhiteList

    struct GUPnPWhiteList;

This struct contains private data only, and should be accessed using the functions below.

### gupnp_white_list_add_entry ()

    gboolean            gupnp_white_list_add_entry          (GUPnPWhiteList *white_list,
                                                             gchar *entry);

Add `entry` in the list of valid criteria used by `white_list` to filter networks. if `entry` already exists, it won't be added a second time.

`white_list` : | A GUPnPWhiteList
`entry` : | A value used to filter network
Returns : | `TRUE` if `entry` is added, `FALSE` otherwise.

### gupnp_white_list_add_entryv ()

    void                gupnp_white_list_add_entryv         (GUPnPWhiteList *white_list,
                                                             gchar **entries);

Add a list of entries to a GUPnPWhiteList. This is a helper function to directly add a `NULL`-terminated array of string usually aquired from commandline args.

`white_list` : | A GUPnPWhiteList
`entries` : | A `NULL`-terminated list of strings. [array zero-terminated=1]

Since 0.20.8

### gupnp_white_list_check_context ()

    gboolean            gupnp_white_list_check_context      (GUPnPWhiteList *white_list,
                                                             GUPnPContext *context);

It will check if the `context` is allowed or not. The `white_list` will check all its entries againt GUPnPContext interface, host ip and network fields information. This function doesn't take into account the `white_list` status (enabled or not).

`white_list` : | A GUPnPWhiteList
`context` : | A GUPnPContext to test.
Returns : | `TRUE` if `context` is matching the `white_list` criterias, `FALSE` otherwise.

### gupnp_white_list_clear ()

    void                gupnp_white_list_clear              (GUPnPWhiteList *white_list);

Remove all entries from GList that compose the white list. The list is now empty. Even if GUPnPWhiteList is enabled, it will have the same behavior as if it was disabled.

`white_list` : | A GUPnPWhiteList

### gupnp_white_list_set_enabled ()

    void                gupnp_white_list_set_enabled        (GUPnPWhiteList *white_list,
                                                             gboolean enable);

Enable or disable the GUPnPWhiteList to perform the network filtering.

`white_list` : | A GUPnPWhiteList
`enable` : | `TRUE` to enable `white_list`, `FALSE` otherwise

### gupnp_white_list_get_entries ()

    GList *             gupnp_white_list_get_entries        (GUPnPWhiteList *white_list);

Get the GList of entries that compose the white list. Do not free

`white_list` : | A GUPnPWhiteList
Returns : | a GList of entries used to filter networks, interfaces,... or `NULL`. Do not modify or free the list nor its elements. [element-type utf8][transfer none]

### gupnp_white_list_is_empty ()

    gboolean            gupnp_white_list_is_empty           (GUPnPWhiteList *white_list);

Return the state of the entries list of GUPnPWhiteList

`white_list` : | A GUPnPWhiteList
Returns : | `TRUE` if `white_list` is empty, `FALSE` otherwise.

### gupnp_white_list_get_enabled ()

    gboolean            gupnp_white_list_get_enabled        (GUPnPWhiteList *white_list);

Return the status of the GUPnPWhiteList

`white_list` : | A GUPnPWhiteList
Returns : | `TRUE` if `white_list` is enabled, `FALSE` otherwise.

### gupnp_white_list_new ()

    GUPnPWhiteList *    gupnp_white_list_new                (void);

Create a new GUPnPWhiteList. The white list is disabled by default.

Returns : | A new GUPnPWhiteList object. [transfer full]

### gupnp_white_list_remove_entry ()

    gboolean            gupnp_white_list_remove_entry       (GUPnPWhiteList *white_list,
                                                             gchar *entry);

Remove `entry` in the list of valid criteria used by `white_list` to filter networks.

`white_list` : | A GUPnPWhiteList
`entry` : | A value to remove from the filter list.
Returns : | `TRUE` if `entry` is removed, `FALSE` otherwise.