GUPnP.ContextFilter¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c/en |
|
||
r/w/co/en |
|
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class GUPnP.ContextFilter(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Network context filter, used by [class`GUPnP`.ContextManager]
GUPnP.ContextFilter
handles network filtering. It provides API to manage a list of entries that will be used to positive filter networks. TheGUPnP.ContextFilter
could be enabled or not. If it’s enabled but the entries list is empty, it behaves as if being disabled.The
GUPnP.ContextFilter
is used with the [class`GUPnP`.ContextManager] to narrow down the contexts that are notified by it.Contexts can be filtered by the following criteria:
Their IP addresses
The network device they will live on
The name of the network the context would join
To add or modify a context filter, you need to retrieve the current context filter from the context manger using [method`GUPnP`.ContextManager.get_context_filter].
By default, a context filter is empty and disabled.
For example, to only react to contexts that are appearing on eth0 or when being in the WiFi network with the SSID “HomeNetwork”, and on IPv6 localhost, you should do:
```c
GUPnP.ContextFilter
filter;filter =
GUPnP.ContextManager.get_context_filter
(manager); conststr
*filter_entries[] = { “eth0”, “HomeNetwork”, “::1”,None
};GUPnP.ContextFilter.add_entryv
(filter, filter_entries);GUPnP.ContextFilter.set_enabled
(filter,True
); ```New in version 1.4.0.
- add_entry(entry)¶
- Parameters:
entry (
str
) – A value used to filter network- Returns:
- Return type:
Add entry in the list of valid criteria used by self to filter networks. if entry already exists, it won’t be added a second time.
New in version 1.4.0.
- add_entryv(entries)¶
-
Add a list of entries to a
GUPnP.ContextFilter
. This is a helper function to directly add aNone
-terminated array of string usually acquired from command line arguments.New in version 1.4.0.
- check_context(context)¶
- Parameters:
context (
GUPnP.Context
) – AGUPnP.Context
to test.- Returns:
True
if context is matching the self criteria,False
otherwise.- Return type:
It will check if the context is allowed or not. The self will check all its entries against
GUPnP.Context
interface, host IP and network fields information. This function doesn’t take into account the self status (enabled or not).New in version 1.4.0.
- clear()¶
Remove all entries from
GLib.List
that compose the context filter. The list is now empty. Even ifGUPnP.ContextFilter
is enabled, it will have the same behavior as if it was disabled.New in version 1.4.0.
- get_enabled()¶
-
Return the status of the
GUPnP.ContextFilter
New in version 1.4.0.
- get_entries()¶
-
Get the
GLib.List
of entries that compose the context filter. Do not freeNew in version 1.4.0.
- is_empty()¶
-
Return the state of the entries list of
GUPnP.ContextFilter
New in version 1.4.0.
- remove_entry(entry)¶
- Parameters:
entry (
str
) – A value to remove from the filter list.- Returns:
- Return type:
Remove entry in the list of valid criteria used by self to filter networks.
New in version 1.4.0.
- set_enabled(enable)¶
-
Enable or disable the
GUPnP.ContextFilter
to perform the network filtering.New in version 1.4.0.
Property Details¶
- GUPnP.ContextFilter.props.enabled¶
-
Whether this context filter is active or not.
New in version 1.4.0.
- GUPnP.ContextFilter.props.entries¶
- Name:
entries
- Type:
- Default Value:
- Flags:
A list of items to filter for.
New in version 1.4.0.