Sun OpenSSO Enterprise 8.0 C API Reference for Application and Web Policy Agent Developers

<am_utils.h>

<am_utils.h> contains functions to encode and decode cookies. The functions are:

am_http_cookie_encode()

Encodes an HTTP cookie.

Syntax

#include "am.h"
AM_EXPORT am_status_t
am_http_cookie_encode(const char *cookie, 
                      char *buf, 
                      int len);

Parameters

This function takes the following parameters:

cookie

Pointer to the cookie.

buf

Pointer to the buffer where the encoded cookie will be stored.

len

The size of the buffer.

Returns

This function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):

AM_SUCCESS

If the cookie was successfully encoded and stored.

AM_INVALID_ARGUMENT

If the cookie or buffer is NULL..

AM_BUFFER_TOO_SMALL

If the defined size is smaller than the encoded value.

AM_FAILURE

If any other error occurred.

am_http_cookie_decode()

Decodes an HTTP cookie.

Syntax

#include "am.h"
AM_EXPORT am_status_t
am_http_cookie_decode(const char *cookie, 
                      char *buf, 
                      int len);

Parameters

This function takes the following parameters:

cookie

Pointer to the cookie.

buf

Pointer to the buffer where the encoded cookie will be stored.

len

The size of the buffer.

Returns

This function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):

AM_SUCCESS

If the cookie was successfully decoded and coped.

AM_INVALID_ARGUMENT

If the cookie or buffer is NULL..

AM_BUFFER_TOO_SMALL

If the defined size is smaller than the decoded value.

AM_FAILURE

If any other error occurred.