## GUPnPAcl

GUPnPAcl — Object providing a simple access control list for GUPnP.

## Functions

gboolean | gupnp_acl_can_sync ()
gboolean | gupnp_acl_is_allowed ()
void | gupnp_acl_is_allowed_async ()
gboolean | gupnp_acl_is_allowed_finish ()

## Types and Values

| GUPnPAcl
struct | GUPnPAclInterface

## Object Hierarchy

        GInterface
        ╰── GUPnPAcl

## Prerequisites

GUPnPAcl requires GObject.

## Description

GUPnPAcl provides either synchronous or asynchronous functions to check whether a peer sould be able to access a resource or not.

## Functions

### gupnp_acl_can_sync ()

    gboolean
    gupnp_acl_can_sync (GUPnPAcl *self);

Check whether `gupnp_acl_is_allowed_async()` is supported.

#### Parameters

self | A GUPnPAcl `returns` `TRUE`, if `gupnp_acl_is_allowed_async()` is supported, `FALSE` otherwise. |

Since 0.20.11

### gupnp_acl_is_allowed ()

    gboolean
    gupnp_acl_is_allowed (GUPnPAcl *self,
                          GUPnPDevice *device,
                          GUPnPService *service,
                          const char *path,
                          const char *address,
                          const char *agent);

Check whether an IP address is allowed to access this resource.

#### Parameters

self | an instance of GUPnPAcl |
device | The GUPnPDevice associated with `path` or `NULL` if unknown. | [allow-none]
service | The GUPnPService associated with `path` or `NULL` if unknown. | [allow-none]
path | The path being served. |
address | IP address of the peer. |
agent | The User-Agent header of the peer or `NULL` if not unknown. `returns` `TRUE` if the peer is allowed, `FALSE` otherwise. | [allow-none]

Since 0.20.11

### gupnp_acl_is_allowed_async ()

    void
    gupnp_acl_is_allowed_async (GUPnPAcl *self,
                                GUPnPDevice *device,
                                GUPnPService *service,
                                const char *path,
                                const char *address,
                                const char *agent,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Optional. Check asynchronously whether an IP address is allowed to access this resource. Use this function if the process of verifying the access right is expected to take some time, for example when using D-Bus etc.

If this function is supported, `gupnp_acl_can_sync()` should return `TRUE`.

Use `gupnp_acl_is_allowed_finish()` to retrieve the result.

#### Parameters

self | a GUPnPAcl |
device | The GUPnPDevice associated with `path` or `NULL` if unknown. | [allow-none]
service | The GUPnPService associated with `path` or `NULL` if unknown. | [allow-none]
path | The path being served. |
address | IP address of the peer |
agent | The User-Agent header of the peer or `NULL` if not unknown. | [allow-none]
cancellable | A GCancellable which can be used to cancel the operation. | [allow-none]
callback | Callback to call after the function is done. |
user_data | Some user data. |

Since 0.20.11

### gupnp_acl_is_allowed_finish ()

    gboolean
    gupnp_acl_is_allowed_finish (GUPnPAcl *self,
                                 GAsyncResult *res,
                                 GError **error);

#### Parameters

self | An instance of GUPnPAcl |
res | `GAsyncResult` obtained from the callback in `gupnp_acl_is_allowed_async()` |
error | A return location for a GError describing the failure `returns` `TRUE` if the authentication was successful, `FALSE` otherwise and on error. Check `error` for details. | [allow-none]

Since 0.20.11

## Types and Values

### GUPnPAcl

    typedef struct _GUPnPAcl GUPnPAcl;

Handle to an object implementing the GUPnPAclInterface interface.

### struct GUPnPAclInterface

    struct GUPnPAclInterface {
        GTypeInterface parent;

        gboolean (*is_allowed) (GUPnPAcl     *self,
                                GUPnPDevice  *device,
                                GUPnPService *service,
                                const char   *path,
                                const char   *address,
                                const char   *agent);

        void     (*is_allowed_async) (GUPnPAcl           *self,
                                      GUPnPDevice        *device,
                                      GUPnPService       *service,
                                      const char         *path,
                                      const char         *address,
                                      const char         *agent,
                                      GCancellable       *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer            user_data);

        gboolean (*is_allowed_finish) (GUPnPAcl      *self,
                                       GAsyncResult  *res,
                                       GError       **error);

        gboolean (*can_sync)          (GUPnPAcl *self);
    };

Implement a simple access control list for GUPnP.

#### Members

GTypeInterface `parent`; | The parent interface. |
`is_allowed` () | Check whether access to the resource is granted. |
`is_allowed_async` () | Asynchronously check whether the access is granted. |
`is_allowed_finish` () | Conclude the `is_allowed_async` operation. |
`can_sync` () | Whether the ACL can do sync queries. |

Since 0.20.11