tncs.c File Reference

#include "includes.h"
#include <dlfcn.h>
#include "common.h"
#include "base64.h"
#include "tncs.h"
#include "eap_common/eap_tlv_common.h"
#include "eap_common/eap_defs.h"
Include dependency graph for tncs.c:

Go to the source code of this file.

Classes

struct  tncs_data::conn_imv
struct  tnc_if_imv
struct  tncs_data
struct  tncs_global

Defines

#define IF_TNCCS_END   "\n</TNCCS-Batch>"
#define IF_TNCCS_START
#define TNC_CONFIG_FILE   "/etc/tnc_config"
#define TNC_CONNECTION_STATE_ACCESS_ALLOWED   2
#define TNC_CONNECTION_STATE_ACCESS_ISOLATED   3
#define TNC_CONNECTION_STATE_ACCESS_NONE   4
#define TNC_CONNECTION_STATE_CREATE   0
#define TNC_CONNECTION_STATE_DELETE   5
#define TNC_CONNECTION_STATE_HANDSHAKE   1
#define TNC_IFIMV_VERSION_1   1
#define TNC_MAX_IMV_ID   10
#define TNC_RESULT_ALREADY_INITIALIZED   2
#define TNC_RESULT_CANT_RESPOND   7
#define TNC_RESULT_CANT_RETRY   4
#define TNC_RESULT_FATAL   10
#define TNC_RESULT_ILLEGAL_OPERATION   8
#define TNC_RESULT_INVALID_PARAMETER   6
#define TNC_RESULT_NO_COMMON_VERSION   3
#define TNC_RESULT_NOT_INITIALIZED   1
#define TNC_RESULT_OTHER   9
#define TNC_RESULT_SUCCESS   0
#define TNC_RESULT_WONT_RETRY   5
#define TNC_SUBTYPE_ANY   ((TNC_Subtype) 0xff)
#define TNC_TNCCS_ERROR   0x00000002
#define TNC_TNCCS_PREFERREDLANGUAGE   0x00000003
#define TNC_TNCCS_REASONSTRINGS   0x00000004
#define TNC_TNCCS_RECOMMENDATION   0x00000001
#define TNC_VENDORID_ANY   ((TNC_VendorID) 0xffffff)

Typedefs

typedef TNC_UInt32 TNC_AttributeID
typedef unsigned char * TNC_BufferReference
typedef TNC_UInt32 TNC_ConnectionID
typedef TNC_UInt32 TNC_ConnectionState
typedef TNC_UInt32 TNC_IMV_Action_Recommendation
typedef TNC_UInt32 TNC_IMV_Evaluation_Result
typedef TNC_UInt32 TNC_IMVID
typedef TNC_UInt32 TNC_MessageType
typedef TNC_MessageTypeTNC_MessageTypeList
typedef TNC_UInt32 TNC_Result
typedef TNC_UInt32 TNC_RetryReason
typedef TNC_UInt32 TNC_Subtype
typedef TNC_Result(* TNC_TNCS_BindFunctionPointer )(TNC_IMVID imvID, char *functionName, void **pOutfunctionPointer)
typedef unsigned long TNC_UInt32
typedef TNC_UInt32 TNC_VendorID
typedef TNC_UInt32 TNC_Version

Enumerations

enum  IMV_Action_Recommendation { TNC_IMV_ACTION_RECOMMENDATION_ALLOW, TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS, TNC_IMV_ACTION_RECOMMENDATION_ISOLATE, TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION }
enum  IMV_Evaluation_Result {
  TNC_IMV_EVALUATION_RESULT_COMPLIANT, TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR, TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR, TNC_IMV_EVALUATION_RESULT_ERROR,
  TNC_IMV_EVALUATION_RESULT_DONT_KNOW
}

Functions

TNC_Result TNC_TNCS_BindFunction (TNC_IMVID imvID, char *functionName, void **pOutFunctionPointer)
TNC_Result TNC_TNCS_GetAttribute (TNC_IMVID imvID, TNC_ConnectionID connectionID, TNC_AttributeID attribureID, TNC_UInt32 bufferLength, TNC_BufferReference buffer, TNC_UInt32 *pOutValueLength)
TNC_Result TNC_TNCS_ProvideRecommendation (TNC_IMVID imvID, TNC_ConnectionID connectionID, TNC_IMV_Action_Recommendation recommendation, TNC_IMV_Evaluation_Result evaluation)
TNC_Result TNC_TNCS_ReportMessageTypes (TNC_IMVID imvID, TNC_MessageTypeList supportedTypes, TNC_UInt32 typeCount)
TNC_Result TNC_TNCS_RequestHandshakeRetry (TNC_IMVID imvID, TNC_ConnectionID connectionID, TNC_RetryReason reason)
TNC_Result TNC_TNCS_SendMessage (TNC_IMVID imvID, TNC_ConnectionID connectionID, TNC_BufferReference message, TNC_UInt32 messageLength, TNC_MessageType messageType)
TNC_Result TNC_TNCS_SetAttribute (TNC_IMVID imvID, TNC_ConnectionID connectionID, TNC_AttributeID attribureID, TNC_UInt32 bufferLength, TNC_BufferReference buffer)
static void tncs_batch_ending (struct tncs_data *tncs)
struct wpabuftncs_build_soh_request (void)
u8tncs_copy_send_buf (struct tncs_data *tncs, u8 *pos)
void tncs_deinit (struct tncs_data *tncs)
static enum tncs_process_res tncs_derive_recommendation (struct tncs_data *tncs)
static void tncs_free_imv (struct tnc_if_imv *imv)
static unsigned char * tncs_get_base64 (char *start, size_t *decoded_len)
static struct tncs_datatncs_get_conn (TNC_ConnectionID connectionID)
static struct tnc_if_imvtncs_get_imv (TNC_IMVID imvID)
static void * tncs_get_sym (void *handle, char *func)
static int tncs_get_type (char *start, unsigned int *type)
void tncs_global_deinit (void)
int tncs_global_init (void)
char * tncs_if_tnccs_end (void)
char * tncs_if_tnccs_start (struct tncs_data *tncs)
static int tncs_imv_initialize (struct tnc_if_imv *imv)
static int tncs_imv_notify_connection_change (struct tnc_if_imv *imv, TNC_ConnectionID conn, TNC_ConnectionState state)
static int tncs_imv_provide_bind_function (struct tnc_if_imv *imv)
static int tncs_imv_resolve_funcs (struct tnc_if_imv *imv)
static int tncs_imv_terminate (struct tnc_if_imv *imv)
struct tncs_datatncs_init (void)
void tncs_init_connection (struct tncs_data *tncs)
static int tncs_load_imv (struct tnc_if_imv *imv)
static struct tnc_if_imvtncs_parse_imv (int id, char *start, char *end, int *error)
enum tncs_process_res tncs_process_if_tnccs (struct tncs_data *tncs, const u8 *msg, size_t len)
struct wpabuftncs_process_soh (const u8 *soh_tlv, size_t soh_tlv_len, int *failure)
static int tncs_read_config (struct tncs_global *global)
static void tncs_send_to_imvs (struct tncs_data *tncs, unsigned int type, const u8 *msg, size_t len)
static void tncs_solicit_recommendation (struct tncs_data *tncs)
static int tncs_supported_type (struct tnc_if_imv *imv, unsigned int type)
size_t tncs_total_send_len (struct tncs_data *tncs)
static void tncs_unload_imv (struct tnc_if_imv *imv)

Variables

static struct tncs_globaltncs_global_data = NULL

Define Documentation

#define IF_TNCCS_END   "\n</TNCCS-Batch>"

Definition at line 36 of file tncs.c.

#define IF_TNCCS_START
Value:
"<?xml version=\"1.0\"?>\n" \
"<TNCCS-Batch BatchId=\"%d\" Recipient=\"TNCS\" " \
"xmlns=\"http://www.trustedcomputinggroup.org/IWG/TNC/1_0/IF_TNCCS#\" " \
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " \
"xsi:schemaLocation=\"http://www.trustedcomputinggroup.org/IWG/TNC/1_0/" \
"IF_TNCCS# https://www.trustedcomputinggroup.org/XML/SCHEMA/TNCCS_1.0.xsd\">\n"

Definition at line 29 of file tncs.c.

#define TNC_CONFIG_FILE   "/etc/tnc_config"

Definition at line 28 of file tncs.c.

#define TNC_CONNECTION_STATE_ACCESS_ALLOWED   2

Definition at line 76 of file tncs.c.

#define TNC_CONNECTION_STATE_ACCESS_ISOLATED   3

Definition at line 77 of file tncs.c.

#define TNC_CONNECTION_STATE_ACCESS_NONE   4

Definition at line 78 of file tncs.c.

#define TNC_CONNECTION_STATE_CREATE   0

Definition at line 74 of file tncs.c.

#define TNC_CONNECTION_STATE_DELETE   5

Definition at line 79 of file tncs.c.

#define TNC_CONNECTION_STATE_HANDSHAKE   1

Definition at line 75 of file tncs.c.

#define TNC_IFIMV_VERSION_1   1

Definition at line 81 of file tncs.c.

#define TNC_MAX_IMV_ID   10

Definition at line 147 of file tncs.c.

#define TNC_RESULT_ALREADY_INITIALIZED   2

Definition at line 64 of file tncs.c.

#define TNC_RESULT_CANT_RESPOND   7

Definition at line 69 of file tncs.c.

#define TNC_RESULT_CANT_RETRY   4

Definition at line 66 of file tncs.c.

#define TNC_RESULT_FATAL   10

Definition at line 72 of file tncs.c.

#define TNC_RESULT_ILLEGAL_OPERATION   8

Definition at line 70 of file tncs.c.

#define TNC_RESULT_INVALID_PARAMETER   6

Definition at line 68 of file tncs.c.

#define TNC_RESULT_NO_COMMON_VERSION   3

Definition at line 65 of file tncs.c.

#define TNC_RESULT_NOT_INITIALIZED   1

Definition at line 63 of file tncs.c.

#define TNC_RESULT_OTHER   9

Definition at line 71 of file tncs.c.

#define TNC_RESULT_SUCCESS   0

Definition at line 62 of file tncs.c.

#define TNC_RESULT_WONT_RETRY   5

Definition at line 67 of file tncs.c.

#define TNC_SUBTYPE_ANY   ((TNC_Subtype) 0xff)

Definition at line 84 of file tncs.c.

#define TNC_TNCCS_ERROR   0x00000002

Definition at line 88 of file tncs.c.

#define TNC_TNCCS_PREFERREDLANGUAGE   0x00000003

Definition at line 89 of file tncs.c.

#define TNC_TNCCS_REASONSTRINGS   0x00000004

Definition at line 90 of file tncs.c.

#define TNC_TNCCS_RECOMMENDATION   0x00000001

Definition at line 87 of file tncs.c.

#define TNC_VENDORID_ANY   ((TNC_VendorID) 0xffffff)

Definition at line 83 of file tncs.c.


Typedef Documentation

Definition at line 55 of file tncs.c.

typedef unsigned char* TNC_BufferReference

Definition at line 41 of file tncs.c.

Definition at line 44 of file tncs.c.

Definition at line 45 of file tncs.c.

Definition at line 47 of file tncs.c.

Definition at line 48 of file tncs.c.

Definition at line 43 of file tncs.c.

Definition at line 49 of file tncs.c.

Definition at line 50 of file tncs.c.

Definition at line 54 of file tncs.c.

Definition at line 46 of file tncs.c.

Definition at line 52 of file tncs.c.

typedef TNC_Result(* TNC_TNCS_BindFunctionPointer)(TNC_IMVID imvID, char *functionName, void **pOutfunctionPointer)

Definition at line 57 of file tncs.c.

typedef unsigned long TNC_UInt32

Definition at line 40 of file tncs.c.

Definition at line 51 of file tncs.c.

Definition at line 53 of file tncs.c.


Enumeration Type Documentation

Enumerator:
TNC_IMV_ACTION_RECOMMENDATION_ALLOW 
TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS 
TNC_IMV_ACTION_RECOMMENDATION_ISOLATE 
TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION 

Definition at line 93 of file tncs.c.

Enumerator:
TNC_IMV_EVALUATION_RESULT_COMPLIANT 
TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR 
TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR 
TNC_IMV_EVALUATION_RESULT_ERROR 
TNC_IMV_EVALUATION_RESULT_DONT_KNOW 

Definition at line 101 of file tncs.c.


Function Documentation

TNC_Result TNC_TNCS_BindFunction ( TNC_IMVID  imvID,
char *  functionName,
void **  pOutFunctionPointer 
)

Definition at line 362 of file tncs.c.

TNC_Result TNC_TNCS_GetAttribute ( TNC_IMVID  imvID,
TNC_ConnectionID  connectionID,
TNC_AttributeID  attribureID,
TNC_UInt32  bufferLength,
TNC_BufferReference  buffer,
TNC_UInt32 pOutValueLength 
)

Definition at line 335 of file tncs.c.

TNC_Result TNC_TNCS_ProvideRecommendation ( TNC_IMVID  imvID,
TNC_ConnectionID  connectionID,
TNC_IMV_Action_Recommendation  recommendation,
TNC_IMV_Evaluation_Result  evaluation 
)

Definition at line 308 of file tncs.c.

TNC_Result TNC_TNCS_ReportMessageTypes ( TNC_IMVID  imvID,
TNC_MessageTypeList  supportedTypes,
TNC_UInt32  typeCount 
)

Definition at line 215 of file tncs.c.

TNC_Result TNC_TNCS_RequestHandshakeRetry ( TNC_IMVID  imvID,
TNC_ConnectionID  connectionID,
TNC_RetryReason  reason 
)

Definition at line 297 of file tncs.c.

TNC_Result TNC_TNCS_SendMessage ( TNC_IMVID  imvID,
TNC_ConnectionID  connectionID,
TNC_BufferReference  message,
TNC_UInt32  messageLength,
TNC_MessageType  messageType 
)

Definition at line 248 of file tncs.c.

TNC_Result TNC_TNCS_SetAttribute ( TNC_IMVID  imvID,
TNC_ConnectionID  connectionID,
TNC_AttributeID  attribureID,
TNC_UInt32  bufferLength,
TNC_BufferReference  buffer 
)

Definition at line 349 of file tncs.c.

static void tncs_batch_ending ( struct tncs_data tncs  )  [static]

Definition at line 609 of file tncs.c.

struct wpabuf* tncs_build_soh_request ( void   )  [read]

Definition at line 1238 of file tncs.c.

u8* tncs_copy_send_buf ( struct tncs_data tncs,
u8 pos 
)

Definition at line 680 of file tncs.c.

void tncs_deinit ( struct tncs_data tncs  ) 

Definition at line 1158 of file tncs.c.

static enum tncs_process_res tncs_derive_recommendation ( struct tncs_data tncs  )  [static]

Definition at line 766 of file tncs.c.

static void tncs_free_imv ( struct tnc_if_imv imv  )  [static]

Definition at line 543 of file tncs.c.

static unsigned char* tncs_get_base64 ( char *  start,
size_t *  decoded_len 
) [static]

Definition at line 740 of file tncs.c.

static struct tncs_data* tncs_get_conn ( TNC_ConnectionID  connectionID  )  [static, read]

Definition at line 193 of file tncs.c.

static struct tnc_if_imv* tncs_get_imv ( TNC_IMVID  imvID  )  [static, read]

Definition at line 177 of file tncs.c.

static void* tncs_get_sym ( void *  handle,
char *  func 
) [static]

Definition at line 397 of file tncs.c.

static int tncs_get_type ( char *  start,
unsigned int *  type 
) [static]

Definition at line 729 of file tncs.c.

void tncs_global_deinit ( void   ) 

Definition at line 1217 of file tncs.c.

int tncs_global_init ( void   ) 

Definition at line 1188 of file tncs.c.

char* tncs_if_tnccs_end ( void   ) 

Definition at line 719 of file tncs.c.

char* tncs_if_tnccs_start ( struct tncs_data tncs  ) 

Definition at line 708 of file tncs.c.

static int tncs_imv_initialize ( struct tnc_if_imv imv  )  [static]

Definition at line 446 of file tncs.c.

static int tncs_imv_notify_connection_change ( struct tnc_if_imv imv,
TNC_ConnectionID  conn,
TNC_ConnectionState  state 
) [static]

Definition at line 493 of file tncs.c.

static int tncs_imv_provide_bind_function ( struct tnc_if_imv imv  )  [static]

Definition at line 479 of file tncs.c.

static int tncs_imv_resolve_funcs ( struct tnc_if_imv imv  )  [static]

Definition at line 407 of file tncs.c.

static int tncs_imv_terminate ( struct tnc_if_imv imv  )  [static]

Definition at line 462 of file tncs.c.

struct tncs_data* tncs_init ( void   )  [read]

Definition at line 1139 of file tncs.c.

void tncs_init_connection ( struct tncs_data tncs  ) 

Definition at line 646 of file tncs.c.

static int tncs_load_imv ( struct tnc_if_imv imv  )  [static]

Definition at line 512 of file tncs.c.

static struct tnc_if_imv* tncs_parse_imv ( int  id,
char *  start,
char *  end,
int *  error 
) [static, read]

Definition at line 1035 of file tncs.c.

enum tncs_process_res tncs_process_if_tnccs ( struct tncs_data tncs,
const u8 msg,
size_t  len 
)

Definition at line 852 of file tncs.c.

struct wpabuf* tncs_process_soh ( const u8 soh_tlv,
size_t  soh_tlv_len,
int *  failure 
) [read]

Definition at line 1264 of file tncs.c.

static int tncs_read_config ( struct tncs_global global  )  [static]

Definition at line 1093 of file tncs.c.

static void tncs_send_to_imvs ( struct tncs_data tncs,
unsigned int  type,
const u8 msg,
size_t  len 
) [static]

Definition at line 585 of file tncs.c.

static void tncs_solicit_recommendation ( struct tncs_data tncs  )  [static]

Definition at line 627 of file tncs.c.

static int tncs_supported_type ( struct tnc_if_imv imv,
unsigned int  type 
) [static]

Definition at line 561 of file tncs.c.

size_t tncs_total_send_len ( struct tncs_data tncs  ) 

Definition at line 667 of file tncs.c.

static void tncs_unload_imv ( struct tnc_if_imv imv  )  [static]

Definition at line 550 of file tncs.c.


Variable Documentation

struct tncs_global* tncs_global_data = NULL [static]

Definition at line 174 of file tncs.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:05:03 2013