2 * Copyright (C) 2010 Andreas Steffen
3 * Copyright (C) 2010 HSR Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #include "tnc_if_tnccs.h"
20 typedef struct private_tnc_if_tnccs_t private_tnc_if_tnccs_t
;
23 * Private data of a tnc_if_tnccs_t object.
25 struct private_tnc_if_tnccs_t
{
28 * Public tls_t interface.
33 * Role this TNC IF-TNCCS stack acts as.
38 * TLS stack purpose, as given to constructor
40 tls_purpose_t purpose
;
43 METHOD(tls_t
, process
, status_t
,
44 private_tnc_if_tnccs_t
*this, void *buf
, size_t buflen
)
46 chunk_t in
= { buf
, buflen
};
49 DBG1(DBG_IKE
, "received TNCCS-Batch: %B", &in
);
53 METHOD(tls_t
, build
, status_t
,
54 private_tnc_if_tnccs_t
*this, void *buf
, size_t *buflen
, size_t *msglen
)
57 "<?xml version=\"1.0\"?>\n"
58 "<TNCCS-Batch BatchId=\"1\" Recipient=\"TNCS\"\n"
59 "xmlns=\"http://www.trustedcomputinggroup.org/IWG/TNC/1_0/IF_TNCCS#\"\n"
60 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
61 "xsi:schemaLocation=\"http://www.trustedcomputinggroup.org/IWG/TNC/1_0/IF_TNCCS#\n"
62 "https://www.trustedcomputinggroup.org/XML/SCHEMA/TNCCS_1.0.xsd\">\n"
65 size_t len
= strlen(output
);
66 chunk_t out
= { output
, len
};
69 DBG1(DBG_IKE
, "sending TNCCS-Batch: %B", &out
);
72 memcpy(buf
, output
, len
);
77 METHOD(tls_t
, is_server
, bool,
78 private_tnc_if_tnccs_t
*this)
80 return this->is_server
;
83 METHOD(tls_t
, get_purpose
, tls_purpose_t
,
84 private_tnc_if_tnccs_t
*this)
89 METHOD(tls_t
, is_complete
, bool,
90 private_tnc_if_tnccs_t
*this)
96 METHOD(tls_t
, get_eap_msk
, chunk_t
,
97 private_tnc_if_tnccs_t
*this)
102 METHOD(tls_t
, destroy
, void,
103 private_tnc_if_tnccs_t
*this)
111 tls_t
*tnc_if_tnccs_create(bool is_server
, tls_purpose_t purpose
)
113 private_tnc_if_tnccs_t
*this;
117 case TLS_PURPOSE_EAP_TNC
:
127 .is_server
= _is_server
,
128 .get_purpose
= _get_purpose
,
129 .is_complete
= _is_complete
,
130 .get_eap_msk
= _get_eap_msk
,
133 .is_server
= is_server
,
137 return &this->public;