added IMC and IMV IDs as arguments to send_message()
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 16 Nov 2010 23:04:10 +0000 (00:04 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 16 Nov 2010 23:04:10 +0000 (00:04 +0100)
src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
src/libcharon/plugins/tnccs_20/tnccs_20.c
src/libcharon/tnc/tnccs/tnccs.h
src/libcharon/tnc/tnccs/tnccs_manager.c
src/libcharon/tnc/tnccs/tnccs_manager.h

index be6debb..5cc14f1 100644 (file)
@@ -18,6 +18,8 @@
 #include <debug.h>
 #include <daemon.h>
 
+#define TNC_IMVID_ANY  0xffff
+
 /**
  * Called by the IMC to inform a TNCC about the set of message types the IMC
  * is able to receive
@@ -46,12 +48,12 @@ TNC_Result TNC_TNCC_RequestHandshakeRetry(TNC_IMCID imc_id,
  */
 TNC_Result TNC_TNCC_SendMessage(TNC_IMCID imc_id,
                                                                TNC_ConnectionID connection_id,
-                                                               TNC_BufferReference message,
-                                                               TNC_UInt32 message_len,
-                                                               TNC_MessageType message_type)
+                                                               TNC_BufferReference msg,
+                                                               TNC_UInt32 msg_len,
+                                                               TNC_MessageType msg_type)
 {
-       return charon->tnccs->send_message(charon->tnccs, connection_id, message,
-                                                                          message_len, message_type);
+       return charon->tnccs->send_message(charon->tnccs, imc_id, TNC_IMVID_ANY,
+                                                                          connection_id, msg, msg_len, msg_type);
 }
 
 /**
index cc4f5b2..e36997e 100644 (file)
@@ -18,6 +18,8 @@
 #include <debug.h>
 #include <daemon.h>
 
+#define TNC_IMCID_ANY  0xffff
+
 /**
  * Called by the IMV to inform a TNCS about the set of message types the IMV
  * is able to receive
@@ -46,12 +48,12 @@ TNC_Result TNC_TNCS_RequestHandshakeRetry(TNC_IMVID imv_id,
  */
 TNC_Result TNC_TNCS_SendMessage(TNC_IMVID imv_id,
                                                                TNC_ConnectionID connection_id,
-                                                               TNC_BufferReference message,
-                                                               TNC_UInt32 message_len,
-                                                               TNC_MessageType message_type)
+                                                               TNC_BufferReference msg,
+                                                               TNC_UInt32 msg_len,
+                                                               TNC_MessageType msg_type)
 {
-       return charon->tnccs->send_message(charon->tnccs, connection_id, message,
-                                                                          message_len, message_type);
+       return charon->tnccs->send_message(charon->tnccs, TNC_IMCID_ANY, imv_id,
+                                                                          connection_id, msg, msg_len, msg_type);
 }
 
 /**
index afd105c..8d29bfb 100644 (file)
@@ -61,7 +61,8 @@ struct private_tnccs_20_t {
 };
 
 METHOD(tnccs_t, send_message, void,
-       private_tnccs_20_t* this, TNC_BufferReference message,
+       private_tnccs_20_t* this, TNC_IMCID imc_id, TNC_IMVID imv_id,
+                                                         TNC_BufferReference message,
                                                          TNC_UInt32 message_len,
                                                          TNC_MessageType message_type)
 {
index e4b7585..48374aa 100644 (file)
@@ -22,6 +22,7 @@
 #define TNCCS_H_
 
 #include <tnc/tncif.h>
+#include <tnc/tncifimc.h>
 #include <tnc/tncifimv.h>
 #include <library.h>
 
@@ -54,13 +55,16 @@ typedef tnccs_t* (*tnccs_constructor_t)(bool is_server);
 /**
  * Callback function adding a message to a TNCCS batch
  *
- * @param message                      message to be added
- * @param message_len          message length
- * @param message_type         message type
+ * @param imc_id               ID of IMC or TNC_IMCID_ANY
+ * @param imc_id               ID of IMV or TNC_IMVID_ANY
+ * @param msg                  message to be added
+ * @param msg_len              message length
+ * @param msg_type             message type
  */
-typedef void (*tnccs_send_message_t)(tnccs_t* tncss,
-                                                                        TNC_BufferReference message,
-                                                                        TNC_UInt32 message_len,
-                                                                        TNC_MessageType message_type);
+typedef void (*tnccs_send_message_t)(tnccs_t* tncss, TNC_IMCID imc_id,
+                                                                                                        TNC_IMVID imv_id,
+                                                                                                        TNC_BufferReference msg,
+                                                                                                        TNC_UInt32 msg_len,
+                                                                                                        TNC_MessageType msg_type);
 
 #endif /** TNCCS_H_ @}*/
index 14c6480..898c4f0 100644 (file)
@@ -233,10 +233,11 @@ METHOD(tnccs_manager_t, remove_connection, void,
 }
 
 METHOD(tnccs_manager_t, send_message, TNC_Result,
-       private_tnccs_manager_t *this, TNC_ConnectionID id,
-                                                                  TNC_BufferReference message,
-                                                                  TNC_UInt32 message_len,
-                                                                  TNC_MessageType message_type)
+       private_tnccs_manager_t *this, TNC_IMCID imc_id, TNC_IMVID imv_id,
+                                                                  TNC_ConnectionID id,
+                                                                  TNC_BufferReference msg,
+                                                                  TNC_UInt32 msg_len,
+                                                                  TNC_MessageType msg_type)
 {
        enumerator_t *enumerator;
        tnccs_connection_entry_t *entry;
@@ -259,7 +260,7 @@ METHOD(tnccs_manager_t, send_message, TNC_Result,
 
        if (tnccs && send_message)
        {
-               send_message(tnccs, message, message_len, message_type);
+               send_message(tnccs, imc_id, imv_id, msg, msg_len, msg_type);
                return TNC_RESULT_SUCCESS;
         }
        return TNC_RESULT_FATAL;
index 7c0c7d2..23f7a68 100644 (file)
@@ -86,14 +86,18 @@ struct tnccs_manager_t {
        /**
         * Add an IMC/IMV message to the batch of a given connection ID.
         *
-        * @param id                            target connection ID
+        * @param imc_id                        ID of IMC or TNC_IMCID_ANY
+        * @param imv_id                        ID of IMV or TNC_IMVID_ANY
+        * @param connection_id         ID of target connection
         * @param msg                           message to be added
         * @param msg_len                       message length
         * @param msg_type                      message type
         * @return                                      return code
         */
        TNC_Result (*send_message)(tnccs_manager_t *this,
-                                                          TNC_ConnectionID id,
+                                                          TNC_IMCID imc_id,
+                                                          TNC_IMVID imv_id,
+                                                          TNC_ConnectionID connection_id,
                                                           TNC_BufferReference msg,
                                                           TNC_UInt32 msg_len,
                                                           TNC_MessageType msg_type);