junos_aaa.h File Reference

Juniper AAA library functions. More...


Data Structures

struct  junos_aaa_attr_s
 AAA attribute list entry. More...
struct  junos_aaa_msg_s
 AAA message to client. More...

Defines

#define JUNOS_AAA_PROFILE_NAME_SIZE   64
 Max length of profile name with ''.
#define JUNOS_AAA_USERNAME_SIZE   256
 Max length of user name with ''.
#define JUNOS_AAA_PASSWORD_SIZE   256
 Max length of password with ''.
#define JUNOS_AAA_USER_SESSION_ID_SIZE   64
 Max length of user session ID with ''.

Typedefs

typedef junos_aaa_session_hdl_s * junos_aaa_session_hdl_t
 Opaque session handle.
typedef uint32_t junos_aaa_req_id_t
 Request ID.
typedef junos_aaa_attr_list_s junos_aaa_attr_list_t
 Opaque attribute list pointer.
typedef enum junos_aaa_req_type_e junos_aaa_req_type_t
 enum of request types.
typedef enum junos_aaa_op_e junos_aaa_op_t
 AAA operations.
typedef enum junos_aaa_msg_type_e junos_aaa_msg_type_t
typedef enum junos_aaa_reply_code_e junos_aaa_reply_code_t
 AAA reply codes.
typedef enum junos_aaa_attr_type_e junos_aaa_attr_type_t
 enum of attribute types.
typedef junos_aaa_attr_s junos_aaa_attr_t
 AAA attribute list entry.
typedef junos_aaa_msg_s junos_aaa_msg_t
 AAA message to client.
typedef void(* junos_aaa_msg_hdlr_t )(junos_aaa_session_hdl_t hdl, junos_aaa_msg_t *msg)
 This message handler is invoked when receiving a message from the server.

Enumerations

enum  junos_aaa_req_type_e { JUNOS_AAA_REQ_INVALID = -1, JUNOS_AAA_REQ_AUTHENTICATE, JUNOS_AAA_REQ_ACCOUNT }
 enum of request types. More...
enum  junos_aaa_op_e {
  JUNOS_AAA_OP_INVALID = -1, JUNOS_AAA_OP_OK, JUNOS_AAA_OP_AUTHENTICATE_REQUEST, JUNOS_AAA_OP_AUTHENTICATE_LOGOUT,
  JUNOS_AAA_OP_ACCOUNT_START, JUNOS_AAA_OP_ACCOUNT_STOP, JUNOS_AAA_OP_ACCOUNT_INTERIM
}
 AAA operations. More...
enum  junos_aaa_msg_type_e {
  JUNOS_AAA_MSG_INVALID = -1, JUNOS_AAA_MSG_SESSION, JUNOS_AAA_MSG_REPLY, JUNOS_AAA_MSG_CMD,
  JUNOS_AAA_MSG_REQ_FREE
}
enum  junos_aaa_reply_code_e {
  JUNOS_AAA_REPLY_OK, JUNOS_AAA_REPLY_TIMEOUT, JUNOS_AAA_REPLY_ERROR, JUNOS_AAA_REPLY_ERROR_REQ,
  JUNOS_AAA_REPLY_ERROR_LICENSE
}
 AAA reply codes. More...
enum  junos_aaa_attr_type_e {
  JUNOS_AAA_ATTR_USERNAME = 1, JUNOS_AAA_ATTR_PASSWORD, JUNOS_AAA_ATTR_CHAP_PASSWORD, JUNOS_AAA_ATTR_NAS_IP_ADDRESS,
  JUNOS_AAA_ATTR_NAS_PORT, JUNOS_AAA_ATTR_SERVICE_TYPE, JUNOS_AAA_ATTR_CALLED_STATION_ID = 30, JUNOS_AAA_ATTR_CALLING_STATION_ID,
  JUNOS_AAA_ATTR_ACCT_STATUS_TYPE = 40, JUNOS_AAA_ATTR_ACCT_DELAY_TIME, JUNOS_AAA_ATTR_ACCT_INPUT_OCTETS, JUNOS_AAA_ATTR_ACCT_OUTPUT_OCTETS,
  JUNOS_AAA_ATTR_ACCT_SESSION_ID, JUNOS_AAA_ATTR_ACCT_AUTHENTIC, JUNOS_AAA_ATTR_ACCT_SESSION_TIME, JUNOS_AAA_ATTR_ACCT_INPUT_PACKETS,
  JUNOS_AAA_ATTR_ACCT_OUTPUT_PACKETS, JUNOS_AAA_ATTR_ACCT_TERMINATE_CAUSE, JUNOS_AAA_ATTR_ACCT_MULTI_SESSION_ID, JUNOS_AAA_ATTR_ACCT_LINK_COUNT,
  JUNOS_AAA_ATTR_ACCT_INPUT_GIGAWORDS, JUNOS_AAA_ATTR_ACCT_OUTPUT_GIGAWORDS, JUNOS_AAA_ATTR_PROFILE_NAME = 256, JUNOS_AAA_ATTR_USER_ID,
  JUNOS_AAA_ATTR_MAX
}
 enum of attribute types. More...

Functions

int junos_aaa_session_open (evContext ctx, junos_aaa_session_hdl_t *hdl, junos_aaa_msg_hdlr_t msg_hdlr)
 Open a session and register a reply handler.
void junos_aaa_session_close (junos_aaa_session_hdl_t hdl)
 Close the session and free the related resource.
int junos_aaa_request (junos_aaa_session_hdl_t hdl, junos_aaa_req_type_t req_type, junos_aaa_op_t op, junos_aaa_attr_list_t *attr_list, junos_aaa_req_id_t *req_id)
 Send an AAA request to the server.
int junos_aaa_attr_list_alloc (junos_aaa_attr_list_t **attr_list)
 Allocate an attribute list.
void junos_aaa_attr_list_free (junos_aaa_attr_list_t *attr_list)
 Free the attribute list.
int junos_aaa_attr_add (junos_aaa_attr_list_t *attr_list, junos_aaa_attr_type_t type, int len, void *val)
 Add an attribute to the list.
junos_aaa_attr_tjunos_aaa_attr_get_next (junos_aaa_attr_list_t *attr_list, junos_aaa_attr_t *attr)
 Get the next attribute from the list.
void junos_aaa_user_id_alloc (uint64_t *user_id)
 Allocate a user ID.
void junos_aaa_user_session_id_alloc (char *user_session_id, int size)
 Allocate a user session ID.


Detailed Description

Juniper AAA library functions.

This library supports authentication and accounting requests from a client SDK application.


Typedef Documentation

typedef enum junos_aaa_attr_type_e junos_aaa_attr_type_t
 

enum of attribute types.

The first 256 attributes (value is from 0 to 255) are standard Radius attribute types defined/reserved in RFC2865 and RFC2866. Non-string attributes must be in network order.

typedef void(* junos_aaa_msg_hdlr_t)(junos_aaa_session_hdl_t hdl, junos_aaa_msg_t *msg)
 

This message handler is invoked when receiving a message from the server.

Parameters:
[in] hdl Session handle
[in] msg Message pointer


Enumeration Type Documentation

enum junos_aaa_attr_type_e
 

enum of attribute types.

The first 256 attributes (value is from 0 to 255) are standard Radius attribute types defined/reserved in RFC2865 and RFC2866. Non-string attributes must be in network order.

Enumerator:
JUNOS_AAA_ATTR_USERNAME  User name.
JUNOS_AAA_ATTR_PASSWORD  User password.
JUNOS_AAA_ATTR_CHAP_PASSWORD  CHAP password.
JUNOS_AAA_ATTR_NAS_IP_ADDRESS  NAS IP address.
JUNOS_AAA_ATTR_NAS_PORT  NAX port.
JUNOS_AAA_ATTR_SERVICE_TYPE  Service type.
JUNOS_AAA_ATTR_CALLED_STATION_ID  Called station ID.
JUNOS_AAA_ATTR_CALLING_STATION_ID  Calling station ID.
JUNOS_AAA_ATTR_ACCT_STATUS_TYPE  Account status type.
JUNOS_AAA_ATTR_ACCT_DELAY_TIME  Account delay time.
JUNOS_AAA_ATTR_ACCT_INPUT_OCTETS  Account input octets.
JUNOS_AAA_ATTR_ACCT_OUTPUT_OCTETS  Account output octets.
JUNOS_AAA_ATTR_ACCT_SESSION_ID  Account session ID.
JUNOS_AAA_ATTR_ACCT_AUTHENTIC  Account authentication.
JUNOS_AAA_ATTR_ACCT_SESSION_TIME  Account session time.
JUNOS_AAA_ATTR_ACCT_INPUT_PACKETS  Account input packets.
JUNOS_AAA_ATTR_ACCT_OUTPUT_PACKETS  Account output packets.
JUNOS_AAA_ATTR_ACCT_TERMINATE_CAUSE  Account terminate cause.
JUNOS_AAA_ATTR_ACCT_MULTI_SESSION_ID  Account multi-session ID.
JUNOS_AAA_ATTR_ACCT_LINK_COUNT  Account link count.
JUNOS_AAA_ATTR_ACCT_INPUT_GIGAWORDS  Account input gigawords.
JUNOS_AAA_ATTR_ACCT_OUTPUT_GIGAWORDS  Account output gigawords.
JUNOS_AAA_ATTR_PROFILE_NAME  AAA profile name in CLI configuration.
JUNOS_AAA_ATTR_USER_ID  User ID allocated by API.

enum junos_aaa_msg_type_e
 

Enumerator:
JUNOS_AAA_MSG_INVALID  Invalid message type.
JUNOS_AAA_MSG_SESSION  Session state message.
JUNOS_AAA_MSG_REPLY  Reply message to the request.
JUNOS_AAA_MSG_CMD  Command from AAA daemon.
JUNOS_AAA_MSG_REQ_FREE  The request was freed without being sent out.

enum junos_aaa_op_e
 

AAA operations.

Enumerator:
JUNOS_AAA_OP_INVALID  Invalid AAA operation.
JUNOS_AAA_OP_OK  Operation OK.
JUNOS_AAA_OP_AUTHENTICATE_REQUEST  Authenticate access request.
JUNOS_AAA_OP_AUTHENTICATE_LOGOUT  Authenticate user logout.
JUNOS_AAA_OP_ACCOUNT_START  Accounting start.
JUNOS_AAA_OP_ACCOUNT_STOP  Accounting stop.
JUNOS_AAA_OP_ACCOUNT_INTERIM  Accounting interim.

enum junos_aaa_reply_code_e
 

AAA reply codes.

Enumerator:
JUNOS_AAA_REPLY_OK  Request succeeded.
JUNOS_AAA_REPLY_TIMEOUT  Timeout.
JUNOS_AAA_REPLY_ERROR  Request failed.
JUNOS_AAA_REPLY_ERROR_REQ  Request format error.
JUNOS_AAA_REPLY_ERROR_LICENSE  License error.

enum junos_aaa_req_type_e
 

enum of request types.

Enumerator:
JUNOS_AAA_REQ_INVALID  Invalid request.
JUNOS_AAA_REQ_AUTHENTICATE  Authentication request.
JUNOS_AAA_REQ_ACCOUNT  Accounting request.


Function Documentation

int junos_aaa_attr_add junos_aaa_attr_list_t attr_list,
junos_aaa_attr_type_t  type,
int  len,
void *  val
 

Add an attribute to the list.

Parameters:
[in] attr_list Attribute list
[in] type Attribute type
[in] len Attribute value length
[in] val Pointer to the attribute value
Returns:
0 on success, -1 on failure

junos_aaa_attr_t* junos_aaa_attr_get_next junos_aaa_attr_list_t attr_list,
junos_aaa_attr_t attr
 

Get the next attribute from the list.

Parameters:
[in] attr_list Pointer to the attribute list
[in] attr Pointer to the current attribute
Returns:
  • The first attribute if attr is NULL.
  • The next attribute.
  • NULL on failure or that attr is the last attribute.

int junos_aaa_attr_list_alloc junos_aaa_attr_list_t **  attr_list  ) 
 

Allocate an attribute list.

Parameters:
[in] attr_list Pointer to the location to store the allocated attribute list
Returns:
0 on success, -1 on failure

void junos_aaa_attr_list_free junos_aaa_attr_list_t attr_list  ) 
 

Free the attribute list.

Parameters:
[in] attr_list Pointer to the attribute list

int junos_aaa_request junos_aaa_session_hdl_t  hdl,
junos_aaa_req_type_t  req_type,
junos_aaa_op_t  op,
junos_aaa_attr_list_t attr_list,
junos_aaa_req_id_t req_id
 

Send an AAA request to the server.

Parameters:
[in] hdl Session handle
[in] op Authentication operation
[in] attr_list Pointer to the attribute list
[in] req_id Pointer to the request ID
Returns:
0 on success, -1 on return

void junos_aaa_session_close junos_aaa_session_hdl_t  hdl  ) 
 

Close the session and free the related resource.

This is used before the process exits or after the connection was broken.

Parameters:
[in] hdl Session handle

int junos_aaa_session_open evContext  ctx,
junos_aaa_session_hdl_t hdl,
junos_aaa_msg_hdlr_t  msg_hdlr
 

Open a session and register a reply handler.

This is a synchronous API that can block. The connection has been successfully set up if it returns 0. Otherwise, the application should retry it.

Parameters:
[in] ctx Event context
[in] hdl Pointer to the session handle
[in] reply_hdlr Reply handler
Returns:
0 on success, -1 on failure

void junos_aaa_user_id_alloc uint64_t *  user_id  ) 
 

Allocate a user ID.

Parameters:
[in] user_id Pointer to the user ID

void junos_aaa_user_session_id_alloc char *  user_session_id,
int  size
 

Allocate a user session ID.

Parameters:
[in] user_session_id Pointer to the user session ID
[in] size The size of user_session_id; the size must be equal to or greater than JUNOS_AAA_USER_SESSION_ID_SIZE.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:23:44 2010 for libjunos-aaa by Doxygen 1.4.5