GstRTSPToken

## GstRTSPToken GstRTSPToken — Roles and permissions for a client |

## Synopsis

    struct              GstRTSPToken;
    GstRTSPToken *      gst_rtsp_token_new_empty            (void);
    GstRTSPToken *      gst_rtsp_token_new                  (const gchar *firstfield,
                                                             ...);
    GstRTSPToken *      gst_rtsp_token_new_valist           (const gchar *firstfield,
                                                             va_list var_args);
    GstRTSPToken *      gst_rtsp_token_ref                  (GstRTSPToken *token);
    void                gst_rtsp_token_unref                (GstRTSPToken *token);
    const GstStructure * gst_rtsp_token_get_structure       (GstRTSPToken *token);
    GstStructure *      gst_rtsp_token_writable_structure   (GstRTSPToken *token);
    const gchar *       gst_rtsp_token_get_string           (GstRTSPToken *token,
                                                             const gchar *field);
    gboolean            gst_rtsp_token_is_allowed           (GstRTSPToken *token,
                                                             const gchar *field);

## Description

A GstRTSPToken contains the permissions and roles of the user performing the current request. A token is usually created when a user is authenticated by the GstRTSPAuth object and is then placed as the current token for the current request.

GstRTSPAuth can use the token and its contents to check authorization for various operations by comparing the token to the GstRTSPPermissions of the object.

The accepted values of the token are entirely defined by the GstRTSPAuth object that implements the security policy.

Last reviewed on 2013-07-15 (1.0.0)

## Details

### struct GstRTSPToken

    struct GstRTSPToken {
      GstMiniObject mini_object;
    };

An opaque object used for checking authorisations. It is generated after successful authentication.

### gst_rtsp_token_new_empty ()

    GstRTSPToken *      gst_rtsp_token_new_empty            (void);

Create a new empty Authorization token.

Returns : | a new empty authorization token. [transfer full]

### gst_rtsp_token_new ()

    GstRTSPToken *      gst_rtsp_token_new                  (const gchar *firstfield,
                                                             ...);

Create a new Authorization token with the given fieldnames and values. Arguments are given similar to `gst_structure_new()`.

`firstfield` : | the first fieldname
`...` : | additional arguments
Returns : | a new authorization token. [transfer full]

### gst_rtsp_token_new_valist ()

    GstRTSPToken *      gst_rtsp_token_new_valist           (const gchar *firstfield,
                                                             va_list var_args);

Create a new Authorization token with the given fieldnames and values. Arguments are given similar to `gst_structure_new_valist()`.

`firstfield` : | the first fieldname
`var_args` : | additional arguments
Returns : | a new authorization token. [transfer full]

### gst_rtsp_token_ref ()

    GstRTSPToken *      gst_rtsp_token_ref                  (GstRTSPToken *token);

Increase the refcount of this token.

`token` : | The token to refcount
Returns : | `token` (for convenience when doing assignments). [transfer full]

### gst_rtsp_token_unref ()

    void                gst_rtsp_token_unref                (GstRTSPToken *token);

Decrease the refcount of an token, freeing it if the refcount reaches 0.

`token` : | the token to refcount. [transfer full]

### gst_rtsp_token_get_structure ()

    const GstStructure * gst_rtsp_token_get_structure       (GstRTSPToken *token);

Access the structure of the token.

`token` : | The GstRTSPToken.
Returns : | The structure of the token. The structure is still owned by the token, which means that you should not free it and that the pointer becomes invalid when you free the token. MT safe.

### gst_rtsp_token_writable_structure ()

    GstStructure *      gst_rtsp_token_writable_structure   (GstRTSPToken *token);

Get a writable version of the structure.

`token` : | The GstRTSPToken.
Returns : | The structure of the token. The structure is still owned by the token, which means that you should not free it and that the pointer becomes invalid when you free the token. This function checks if `token` is writable and will never return `NULL`. MT safe.

### gst_rtsp_token_get_string ()

    const gchar *       gst_rtsp_token_get_string           (GstRTSPToken *token,
                                                             const gchar *field);

Get the string value of `field` in `token`.

`token` : | a GstRTSPToken
`field` : | a field name
Returns : | the string value of `field` in `token` or `NULL` when `field` is not defined in `token`.

### gst_rtsp_token_is_allowed ()

    gboolean            gst_rtsp_token_is_allowed           (GstRTSPToken *token,
                                                             const gchar *field);

Check if `token` has a boolean `field` and if it is set to `TRUE`.

`token` : | a GstRTSPToken
`field` : | a field name
Returns : | `TRUE` if `token` has a boolean field named `field` set to `TRUE`.

## See Also

GstRTSPClient, GstRTSPPermissions, GstRTSPAuth