static upper size limit for PA-TNC messages
[strongswan.git] / src / libimcv / imc / imc_agent.h
index 7c7ef73..33335d1 100644 (file)
 #define IMC_AGENT_H_
 
 #include "imc_state.h"
+#include "pa_tnc/pa_tnc_msg.h"
 
 #include <tncifimc.h>
 #include <pen/pen.h>
+#include <utils/linked_list.h>
 
 #include <library.h>
 
@@ -78,11 +80,13 @@ struct imc_agent_t {
         *
         * @param connection_id         network connection ID assigned by TNCS
         * @param new_state                     new state of TNCCS connection
+        * @param state_p                       internal IMC state instance [optional argument]
         * @return                                      TNC result code
         */
        TNC_Result (*change_state)(imc_agent_t *this,
                                                           TNC_ConnectionID connection_id,
-                                                          TNC_ConnectionState new_state);
+                                                          TNC_ConnectionState new_state,
+                                                          imc_state_t **state_p);
 
        /**
         * Get the IMC state for a TNCCS connection instance
@@ -95,15 +99,59 @@ struct imc_agent_t {
                                          TNC_ConnectionID connection_id, imc_state_t **state);
 
        /**
-        * Call when an IMC-IMV message is to be sent
+        * Call when an PA-TNC message is to be sent
         *
         * @param connection_id         network connection ID assigned by TNCC
-        * @param msg                           message to send
+        * @param excl                          exclusive flag
+        * @param src_imc_id            IMC ID to be set as source
+        * @param dst_imv_id            IMV ID to be set as destination
+        * @param attr_list                     list of PA-TNC attributes to send
         * @return                                      TNC result code
         */
        TNC_Result (*send_message)(imc_agent_t *this,
-                                                          TNC_ConnectionID connection_id,
-                                                          chunk_t msg);
+                                                          TNC_ConnectionID connection_id, bool excl,
+                                                          TNC_UInt32 src_imc_id, TNC_UInt32 dst_imv_id,
+                                                          linked_list_t *attr_list);
+
+       /**
+        * Call when a PA-TNC message was received
+        *
+        * @param state                         state for current connection
+        * @param msg                           received unparsed message
+        * @param msg_vid                       message vendorID of the received message
+        * @param msg_subtype           message subtype of the received message
+        * @param src_imv_id            source IMV ID
+        * @param dst_imc_id            destination IMC ID
+        * @param pa_tnc_message        parsed PA-TNC message or NULL if an error occurred
+        * @return                                      TNC result code
+        */
+       TNC_Result (*receive_message)(imc_agent_t *this,
+                                                                 imc_state_t *state, chunk_t msg,
+                                                                 TNC_VendorID msg_vid,
+                                                                 TNC_MessageSubtype msg_subtype,
+                                                                 TNC_UInt32 src_imv_id,
+                                                                 TNC_UInt32 dst_imc_id,
+                                                                 pa_tnc_msg_t **pa_tnc_msg);
+
+       /**
+        * Reserve additional IMC IDs from TNCC
+        *
+        * @param count                         number of additional IMC IDs to be assigned
+        * @return                                      TNC result code
+        */
+       TNC_Result (*reserve_additional_ids)(imc_agent_t *this, int count);
+
+       /**
+        * Return the number of additional IMC IDs assigned by the TNCC
+        *
+        * @return                                      number of additional IMC IDs
+        */
+       int (*count_additional_ids)(imc_agent_t *this);
+
+       /**
+        * Create an enumerator for the additional IMC IDs
+        */
+       enumerator_t* (*create_id_enumerator)(imc_agent_t *this);
 
        /**
         * Destroys an imc_agent_t object