## GUPnPContextFilter GUPnPContextFilter — Class for network filtering. |

## Functions

gboolean | gupnp_context_filter_add_entry ()
void | gupnp_context_filter_add_entryv ()
gboolean | gupnp_context_filter_check_context ()
void | gupnp_context_filter_clear ()
gboolean | gupnp_context_filter_get_enabled ()
GList * | gupnp_context_filter_get_entries ()
gboolean | gupnp_context_filter_is_empty ()
gboolean | gupnp_context_filter_remove_entry ()
void | gupnp_context_filter_set_enabled ()
GUPnPContextFilter * | gupnp_context_manager_get_context_filter ()

## Types and Values

| GUPnPContextFilter
struct | GUPnPContextFilterClass

## Description

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

## Functions

### gupnp_context_filter_add_entry ()

    gboolean
    gupnp_context_filter_add_entry (GUPnPContextFilter *context_filter,
                                    const gchar *entry);

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

#### Parameters

context_filter | A GUPnPContextFilter |
entry | A value used to filter network |

#### Returns

`TRUE` if `entry` is added, `FALSE` otherwise.

Since: 1.4.0

### gupnp_context_filter_add_entryv ()

    void
    gupnp_context_filter_add_entryv (GUPnPContextFilter *context_filter,
                                     gchar **entries);

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

#### Parameters

context_filter | A GUPnPContextFilter |
entries | A `NULL`-terminated list of strings. | [array zero-terminated=1]

Since: 1.4.0

### gupnp_context_filter_check_context ()

    gboolean
    gupnp_context_filter_check_context (GUPnPContextFilter *context_filter,
                                        GUPnPContext *context);

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

#### Parameters

context_filter | A GUPnPContextFilter |
context | A GUPnPContext to test. |

#### Returns

`TRUE` if `context` is matching the `context_filter` criterias, `FALSE` otherwise.

Since: 1.4.0

### gupnp_context_filter_clear ()

    void
    gupnp_context_filter_clear (GUPnPContextFilter *context_filter);

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

#### Parameters

context_filter | A GUPnPContextFilter |

Since: 1.4.0

### gupnp_context_filter_get_enabled ()

    gboolean
    gupnp_context_filter_get_enabled (GUPnPContextFilter *context_filter);

Return the status of the GUPnPContextFilter

#### Parameters

context_filter | A GUPnPContextFilter |

#### Returns

`TRUE` if `context_filter` is enabled, `FALSE` otherwise.

Since: 1.4.0

### gupnp_context_filter_get_entries ()

    GList *
    gupnp_context_filter_get_entries (GUPnPContextFilter *context_filter);

Get the GList of entries that compose the context filter. Do not free

#### Parameters

context_filter | A GUPnPContextFilter |

#### 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 container][nullable]

Since: 1.4.0

### gupnp_context_filter_is_empty ()

    gboolean
    gupnp_context_filter_is_empty (GUPnPContextFilter *context_filter);

Return the state of the entries list of GUPnPContextFilter

#### Parameters

context_filter | A GUPnPContextFilter |

#### Returns

`TRUE` if `context_filter` is empty, `FALSE` otherwise.

Since: 1.4.0

### gupnp_context_filter_remove_entry ()

    gboolean
    gupnp_context_filter_remove_entry (GUPnPContextFilter *context_filter,
                                       const gchar *entry);

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

#### Parameters

context_filter | A GUPnPContextFilter |
entry | A value to remove from the filter list. |

#### Returns

`TRUE` if `entry` is removed, `FALSE` otherwise.

Since: 1.4.0

### gupnp_context_filter_set_enabled ()

    void
    gupnp_context_filter_set_enabled (GUPnPContextFilter *context_filter,
                                      gboolean enable);

Enable or disable the GUPnPContextFilter to perform the network filtering.

#### Parameters

context_filter | A GUPnPContextFilter |
enable | `TRUE` to enable `context_filter` , `FALSE` otherwise |

Since: 1.4.0

### gupnp_context_manager_get_context_filter ()

    GUPnPContextFilter *
    gupnp_context_manager_get_context_filter
                                   (GUPnPContextManager *manager);

Get the GUPnPContextFilter associated with `manager` .

#### Parameters

manager | A GUPnPContextManager |

#### Returns

The GUPnPContextFilter asssociated with this context manager.

[transfer none]

## Types and Values

### GUPnPContextFilter

    typedef struct _GUPnPContextFilter GUPnPContextFilter;

Class for network context filtering.

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

Since: 1.4.0

### struct GUPnPContextFilterClass

    struct GUPnPContextFilterClass {
            GObjectClass parent_class;
    };