moved management of additional IMC/IMV IDs to agent
[strongswan.git] / src / libimcv / imc / imc_agent.c
1 /*
2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 #include "imcv.h"
16 #include "imc_agent.h"
17
18 #include <tncif_names.h>
19
20 #include <debug.h>
21 #include <utils/linked_list.h>
22 #include <threading/rwlock.h>
23
24 typedef struct private_imc_agent_t private_imc_agent_t;
25
26 /**
27 * Private data of an imc_agent_t object.
28 */
29 struct private_imc_agent_t {
30
31 /**
32 * Public members of imc_agent_t
33 */
34 imc_agent_t public;
35
36 /**
37 * name of IMC
38 */
39 const char *name;
40
41 /**
42 * message vendor ID of IMC
43 */
44 TNC_VendorID vendor_id;
45
46 /**
47 * message subtype of IMC
48 */
49 TNC_MessageSubtype subtype;
50
51 /**
52 * ID of IMC as assigned by TNCC
53 */
54 TNC_IMCID id;
55
56 /**
57 * List of additional IMC IDs assigned by TNCC
58 */
59 linked_list_t *additional_ids;
60
61 /**
62 * list of TNCC connection entries
63 */
64 linked_list_t *connections;
65
66 /**
67 * rwlock to lock TNCC connection entries
68 */
69 rwlock_t *connection_lock;
70
71 /**
72 * Inform a TNCC about the set of message types the IMC is able to receive
73 *
74 * @param imc_id IMC ID assigned by TNCC
75 * @param supported_types list of supported message types
76 * @param type_count number of list elements
77 * @return TNC result code
78 */
79 TNC_Result (*report_message_types)(TNC_IMCID imc_id,
80 TNC_MessageTypeList supported_types,
81 TNC_UInt32 type_count);
82
83 /**
84 * Inform a TNCC about the set of message types the IMC is able to receive
85 *
86 * @param imc_id IMC ID assigned by TNCC
87 * @param supported_vids list of supported message vendor IDs
88 * @param supported_subtypes list of supported message subtypes
89 * @param type_count number of list elements
90 * @return TNC result code
91 */
92 TNC_Result (*report_message_types_long)(TNC_IMCID imc_id,
93 TNC_VendorIDList supported_vids,
94 TNC_MessageSubtypeList supported_subtypes,
95 TNC_UInt32 type_count);
96
97 /**
98 * Call when an IMC-IMC message is to be sent
99 *
100 * @param imc_id IMC ID assigned by TNCC
101 * @param connection_id network connection ID assigned by TNCC
102 * @param msg message to send
103 * @param msg_len message length in bytes
104 * @param msg_type message type
105 * @return TNC result code
106 */
107 TNC_Result (*send_message)(TNC_IMCID imc_id,
108 TNC_ConnectionID connection_id,
109 TNC_BufferReference msg,
110 TNC_UInt32 msg_len,
111 TNC_MessageType msg_type);
112
113
114 /**
115 * Call when an IMC-IMC message is to be sent with long message types
116 *
117 * @param imc_id IMC ID assigned by TNCC
118 * @param connection_id network connection ID assigned by TNCC
119 * @param msg_flags message flags
120 * @param msg message to send
121 * @param msg_len message length in bytes
122 * @param msg_vid message vendor ID
123 * @param msg_subtype message subtype
124 * @param dst_imc_id destination IMV ID
125 * @return TNC result code
126 */
127 TNC_Result (*send_message_long)(TNC_IMCID imc_id,
128 TNC_ConnectionID connection_id,
129 TNC_UInt32 msg_flags,
130 TNC_BufferReference msg,
131 TNC_UInt32 msg_len,
132 TNC_VendorID msg_vid,
133 TNC_MessageSubtype msg_subtype,
134 TNC_UInt32 dst_imv_id);
135
136 /**
137 * Get the value of an attribute associated with a connection
138 * or with the TNCC as a whole.
139 *
140 * @param imc_id IMC ID assigned by TNCC
141 * @param connection_id network connection ID assigned by TNCC
142 * @param attribute_id attribute ID
143 * @param buffer_len length of buffer in bytes
144 * @param buffer buffer
145 * @param out_value_len size in bytes of attribute stored in buffer
146 * @return TNC result code
147 */
148 TNC_Result (*get_attribute)(TNC_IMCID imc_id,
149 TNC_ConnectionID connection_id,
150 TNC_AttributeID attribute_id,
151 TNC_UInt32 buffer_len,
152 TNC_BufferReference buffer,
153 TNC_UInt32 *out_value_len);
154
155 /**
156 * Set the value of an attribute associated with a connection
157 * or with the TNCC as a whole.
158 *
159 * @param imc_id IMV ID assigned by TNCC
160 * @param connection_id network connection ID assigned by TNCC
161 * @param attribute_id attribute ID
162 * @param buffer_len length of buffer in bytes
163 * @param buffer buffer
164 * @return TNC result code
165 */
166 TNC_Result (*set_attribute)(TNC_IMCID imc_id,
167 TNC_ConnectionID connection_id,
168 TNC_AttributeID attribute_id,
169 TNC_UInt32 buffer_len,
170 TNC_BufferReference buffer);
171
172 /**
173 * Reserve an additional IMC ID
174 *
175 * @param imc_id primary IMC ID assigned by TNCC
176 * @param out_imc_id additional IMC ID assigned by TNCC
177 * @return TNC result code
178 */
179 TNC_Result (*reserve_additional_id)(TNC_IMCID imc_id,
180 TNC_UInt32 *out_imc_id);
181
182 };
183
184 METHOD(imc_agent_t, bind_functions, TNC_Result,
185 private_imc_agent_t *this, TNC_TNCC_BindFunctionPointer bind_function)
186 {
187 if (!bind_function)
188 {
189 DBG1(DBG_IMC, "TNC client failed to provide bind function");
190 return TNC_RESULT_INVALID_PARAMETER;
191 }
192 if (bind_function(this->id, "TNC_TNCC_ReportMessageTypes",
193 (void**)&this->report_message_types) != TNC_RESULT_SUCCESS)
194 {
195 this->report_message_types = NULL;
196 }
197 if (bind_function(this->id, "TNC_TNCC_ReportMessageTypesLong",
198 (void**)&this->report_message_types_long) != TNC_RESULT_SUCCESS)
199 {
200 this->report_message_types_long = NULL;
201 }
202 if (bind_function(this->id, "TNC_TNCC_RequestHandshakeRetry",
203 (void**)&this->public.request_handshake_retry) != TNC_RESULT_SUCCESS)
204 {
205 this->public.request_handshake_retry = NULL;
206 }
207 if (bind_function(this->id, "TNC_TNCC_SendMessage",
208 (void**)&this->send_message) != TNC_RESULT_SUCCESS)
209 {
210 this->send_message = NULL;
211 }
212 if (bind_function(this->id, "TNC_TNCC_SendMessageLong",
213 (void**)&this->send_message_long) != TNC_RESULT_SUCCESS)
214 {
215 this->send_message_long = NULL;
216 }
217 if (bind_function(this->id, "TNC_TNCC_GetAttribute",
218 (void**)&this->get_attribute) != TNC_RESULT_SUCCESS)
219 {
220 this->get_attribute = NULL;
221 }
222 if (bind_function(this->id, "TNC_TNCC_SetAttribute",
223 (void**)&this->set_attribute) != TNC_RESULT_SUCCESS)
224 {
225 this->set_attribute = NULL;
226 }
227 if (bind_function(this->id, "TNC_TNCC_ReserveAdditionalIMCID",
228 (void**)&this->reserve_additional_id) != TNC_RESULT_SUCCESS)
229 {
230 this->reserve_additional_id = NULL;
231 }
232 DBG2(DBG_IMC, "IMC %u \"%s\" provided with bind function",
233 this->id, this->name);
234
235 if (this->report_message_types_long)
236 {
237 this->report_message_types_long(this->id, &this->vendor_id,
238 &this->subtype, 1);
239 }
240 else if (this->report_message_types &&
241 this->vendor_id <= TNC_VENDORID_ANY &&
242 this->subtype <= TNC_SUBTYPE_ANY)
243 {
244 TNC_MessageType type;
245
246 type = (this->vendor_id << 8) | this->subtype;
247 this->report_message_types(this->id, &type, 1);
248 }
249 return TNC_RESULT_SUCCESS;
250 }
251
252 /**
253 * finds a connection state based on its Connection ID
254 */
255 static imc_state_t* find_connection(private_imc_agent_t *this,
256 TNC_ConnectionID id)
257 {
258 enumerator_t *enumerator;
259 imc_state_t *state, *found = NULL;
260
261 this->connection_lock->read_lock(this->connection_lock);
262 enumerator = this->connections->create_enumerator(this->connections);
263 while (enumerator->enumerate(enumerator, &state))
264 {
265 if (id == state->get_connection_id(state))
266 {
267 found = state;
268 break;
269 }
270 }
271 enumerator->destroy(enumerator);
272 this->connection_lock->unlock(this->connection_lock);
273
274 return found;
275 }
276
277 /**
278 * delete a connection state with a given Connection ID
279 */
280 static bool delete_connection(private_imc_agent_t *this, TNC_ConnectionID id)
281 {
282 enumerator_t *enumerator;
283 imc_state_t *state;
284 bool found = FALSE;
285
286 this->connection_lock->write_lock(this->connection_lock);
287 enumerator = this->connections->create_enumerator(this->connections);
288 while (enumerator->enumerate(enumerator, &state))
289 {
290 if (id == state->get_connection_id(state))
291 {
292 found = TRUE;
293 state->destroy(state);
294 this->connections->remove_at(this->connections, enumerator);
295 break;
296 }
297 }
298 enumerator->destroy(enumerator);
299 this->connection_lock->unlock(this->connection_lock);
300
301 return found;
302 }
303
304 /**
305 * Read a boolean attribute
306 */
307 static bool get_bool_attribute(private_imc_agent_t *this, TNC_ConnectionID id,
308 TNC_AttributeID attribute_id)
309 {
310 TNC_UInt32 len;
311 char buf[4];
312
313 return this->get_attribute &&
314 this->get_attribute(this->id, id, attribute_id, 4, buf, &len) ==
315 TNC_RESULT_SUCCESS && len == 1 && *buf == 0x01;
316 }
317
318 /**
319 * Read a string attribute
320 */
321 static char* get_str_attribute(private_imc_agent_t *this, TNC_ConnectionID id,
322 TNC_AttributeID attribute_id)
323 {
324 TNC_UInt32 len;
325 char buf[BUF_LEN];
326
327 if (this->get_attribute &&
328 this->get_attribute(this->id, id, attribute_id, BUF_LEN, buf, &len) ==
329 TNC_RESULT_SUCCESS && len <= BUF_LEN)
330 {
331 return strdup(buf);
332 }
333 return NULL;
334 }
335
336 METHOD(imc_agent_t, create_state, TNC_Result,
337 private_imc_agent_t *this, imc_state_t *state)
338 {
339 TNC_ConnectionID conn_id;
340 char *tnccs_p = NULL, *tnccs_v = NULL, *t_p = NULL, *t_v = NULL;
341 bool has_long = FALSE, has_excl = FALSE, has_soh = FALSE;
342
343 conn_id = state->get_connection_id(state);
344 if (find_connection(this, conn_id))
345 {
346 DBG1(DBG_IMC, "IMC %u \"%s\" already created a state for Connection ID %u",
347 this->id, this->name, conn_id);
348 state->destroy(state);
349 return TNC_RESULT_OTHER;
350 }
351
352 /* Get and display attributes from TNCC via IF-IMC */
353 has_long = get_bool_attribute(this, conn_id, TNC_ATTRIBUTEID_HAS_LONG_TYPES);
354 has_excl = get_bool_attribute(this, conn_id, TNC_ATTRIBUTEID_HAS_EXCLUSIVE);
355 has_soh = get_bool_attribute(this, conn_id, TNC_ATTRIBUTEID_HAS_SOH);
356 tnccs_p = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFTNCCS_PROTOCOL);
357 tnccs_v = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFTNCCS_VERSION);
358 t_p = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFT_PROTOCOL);
359 t_v = get_str_attribute(this, conn_id, TNC_ATTRIBUTEID_IFT_VERSION);
360
361 state->set_flags(state, has_long, has_excl);
362
363 DBG2(DBG_IMC, "IMC %u \"%s\" created a state for Connection ID %u: "
364 "%s %s with %slong %sexcl %ssoh over %s %s",
365 this->id, this->name, conn_id, tnccs_p ? tnccs_p:"?",
366 tnccs_v ? tnccs_v:"?", has_long ? "+":"-", has_excl ? "+":"-",
367 has_soh ? "+":"-", t_p ? t_p:"?", t_v ? t_v :"?");
368 free(tnccs_p);
369 free(tnccs_v);
370 free(t_p);
371 free(t_v);
372
373 this->connection_lock->write_lock(this->connection_lock);
374 this->connections->insert_last(this->connections, state);
375 this->connection_lock->unlock(this->connection_lock);
376 return TNC_RESULT_SUCCESS;
377 }
378
379 METHOD(imc_agent_t, delete_state, TNC_Result,
380 private_imc_agent_t *this, TNC_ConnectionID connection_id)
381 {
382 if (!delete_connection(this, connection_id))
383 {
384 DBG1(DBG_IMC, "IMC %u \"%s\" has no state for Connection ID %u",
385 this->id, this->name, connection_id);
386 return TNC_RESULT_FATAL;
387 }
388 DBG2(DBG_IMC, "IMC %u \"%s\" deleted the state of Connection ID %u",
389 this->id, this->name, connection_id);
390 return TNC_RESULT_SUCCESS;
391 }
392
393 METHOD(imc_agent_t, change_state, TNC_Result,
394 private_imc_agent_t *this, TNC_ConnectionID connection_id,
395 TNC_ConnectionState new_state,
396 imc_state_t **state_p)
397 {
398 imc_state_t *state;
399
400 switch (new_state)
401 {
402 case TNC_CONNECTION_STATE_HANDSHAKE:
403 case TNC_CONNECTION_STATE_ACCESS_ALLOWED:
404 case TNC_CONNECTION_STATE_ACCESS_ISOLATED:
405 case TNC_CONNECTION_STATE_ACCESS_NONE:
406 state = find_connection(this, connection_id);
407
408 if (!state)
409 {
410 DBG1(DBG_IMC, "IMC %u \"%s\" has no state for Connection ID %u",
411 this->id, this->name, connection_id);
412 return TNC_RESULT_FATAL;
413 }
414 state->change_state(state, new_state);
415 DBG2(DBG_IMC, "IMC %u \"%s\" changed state of Connection ID %u to '%N'",
416 this->id, this->name, connection_id,
417 TNC_Connection_State_names, new_state);
418 if (state_p)
419 {
420 *state_p = state;
421 }
422 break;
423 case TNC_CONNECTION_STATE_CREATE:
424 DBG1(DBG_IMC, "state '%N' should be handled by create_state()",
425 TNC_Connection_State_names, new_state);
426 return TNC_RESULT_FATAL;
427 case TNC_CONNECTION_STATE_DELETE:
428 DBG1(DBG_IMC, "state '%N' should be handled by delete_state()",
429 TNC_Connection_State_names, new_state);
430 return TNC_RESULT_FATAL;
431 default:
432 DBG1(DBG_IMC, "IMC %u \"%s\" was notified of unknown state %u "
433 "for Connection ID %u",
434 this->id, this->name, new_state, connection_id);
435 return TNC_RESULT_INVALID_PARAMETER;
436 }
437 return TNC_RESULT_SUCCESS;
438 }
439
440 METHOD(imc_agent_t, get_state, bool,
441 private_imc_agent_t *this, TNC_ConnectionID connection_id,
442 imc_state_t **state)
443 {
444 *state = find_connection(this, connection_id);
445 if (!*state)
446 {
447 DBG1(DBG_IMC, "IMC %u \"%s\" has no state for Connection ID %u",
448 this->id, this->name, connection_id);
449 return FALSE;
450 }
451 return TRUE;
452 }
453
454 METHOD(imc_agent_t, send_message, TNC_Result,
455 private_imc_agent_t *this, TNC_ConnectionID connection_id, bool excl,
456 TNC_UInt32 src_imc_id, TNC_UInt32 dst_imv_id, chunk_t msg)
457 {
458 TNC_MessageType type;
459 TNC_UInt32 msg_flags;
460 imc_state_t *state;
461
462 state = find_connection(this, connection_id);
463 if (!state)
464 {
465 DBG1(DBG_IMV, "IMC %u \"%s\" has no state for Connection ID %u",
466 this->id, this->name, connection_id);
467 return TNC_RESULT_FATAL;
468 }
469
470 if (state->has_long(state) && this->send_message_long)
471 {
472 if (!src_imc_id)
473 {
474 src_imc_id = this->id;
475 }
476 msg_flags = excl ? TNC_MESSAGE_FLAGS_EXCLUSIVE : 0;
477
478 return this->send_message_long(src_imc_id, connection_id, msg_flags,
479 msg.ptr, msg.len, this->vendor_id,
480 this->subtype, dst_imv_id);
481 }
482 if (this->send_message)
483 {
484 type = (this->vendor_id << 8) | this->subtype;
485
486 return this->send_message(this->id, connection_id, msg.ptr, msg.len,
487 type);
488 }
489 return TNC_RESULT_FATAL;
490 }
491
492 METHOD(imc_agent_t, receive_message, TNC_Result,
493 private_imc_agent_t *this, imc_state_t *state, chunk_t msg,
494 TNC_VendorID msg_vid, TNC_MessageSubtype msg_subtype,
495 TNC_UInt32 src_imv_id, TNC_UInt32 dst_imc_id, pa_tnc_msg_t **pa_tnc_msg)
496 {
497 pa_tnc_msg_t *pa_msg, *error_msg;
498 pa_tnc_attr_t *error_attr;
499 enumerator_t *enumerator;
500 TNC_MessageType msg_type;
501 TNC_UInt32 msg_flags, src_imc_id, dst_imv_id;
502 TNC_ConnectionID connection_id;
503 TNC_Result result;
504
505 connection_id = state->get_connection_id(state);
506
507 if (state->has_long(state))
508 {
509 if (dst_imc_id != TNC_IMCID_ANY)
510 {
511 DBG2(DBG_IMC, "IMC %u \"%s\" received message for Connection ID %u "
512 "from IMV %u to IMC %u", this->id, this->name,
513 connection_id, src_imv_id, dst_imc_id);
514 }
515 else
516 {
517 DBG2(DBG_IMC, "IMC %u \"%s\" received message for Connection ID %u "
518 "from IMV %u", this->id, this->name, connection_id,
519 src_imv_id);
520 }
521 }
522 else
523 {
524 DBG2(DBG_IMC, "IMC %u \"%s\" received message for Connection ID %u",
525 this->id, this->name, connection_id);
526 }
527
528 *pa_tnc_msg = NULL;
529 pa_msg = pa_tnc_msg_create_from_data(msg);
530
531 switch (pa_msg->process(pa_msg))
532 {
533 case SUCCESS:
534 *pa_tnc_msg = pa_msg;
535 break;
536 case VERIFY_ERROR:
537 /* build error message */
538 error_msg = pa_tnc_msg_create();
539 enumerator = pa_msg->create_error_enumerator(pa_msg);
540 while (enumerator->enumerate(enumerator, &error_attr))
541 {
542 error_msg->add_attribute(error_msg,
543 error_attr->get_ref(error_attr));
544 }
545 enumerator->destroy(enumerator);
546 error_msg->build(error_msg);
547
548 /* send error message */
549 if (state->has_long(state) && this->send_message_long)
550 {
551 if (state->has_excl(state))
552 {
553 msg_flags = TNC_MESSAGE_FLAGS_EXCLUSIVE;
554 dst_imv_id = src_imv_id;
555 }
556 else
557 {
558 msg_flags = 0;
559 dst_imv_id = TNC_IMVID_ANY;
560 }
561 src_imc_id = (dst_imc_id == TNC_IMCID_ANY) ? this->id
562 : dst_imc_id;
563
564 result = this->send_message_long(src_imc_id, connection_id,
565 msg_flags, msg.ptr, msg.len, msg_vid,
566 msg_subtype, dst_imv_id);
567 }
568 else if (this->send_message)
569 {
570 msg_type = (msg_vid << 8) | msg_subtype;
571
572 result = this->send_message(this->id, connection_id,
573 msg.ptr, msg.len, msg_type);
574 }
575 else
576 {
577 result = TNC_RESULT_FATAL;
578 }
579
580 /* clean up */
581 error_msg->destroy(error_msg);
582 pa_msg->destroy(pa_msg);
583 return result;
584 case FAILED:
585 default:
586 pa_msg->destroy(pa_msg);
587 return TNC_RESULT_FATAL;
588 }
589 return TNC_RESULT_SUCCESS;
590 }
591
592 METHOD(imc_agent_t, reserve_additional_ids, TNC_Result,
593 private_imc_agent_t *this, int count)
594 {
595 TNC_Result result;
596 TNC_UInt32 id;
597 void *pointer;
598
599 if (!this->reserve_additional_id)
600 {
601 DBG1(DBG_IMC, "IMC %u \"%s\" did not detect the capability to reserve "
602 "additional IMC IDs from the TNCC", this->id, this->name);
603 return TNC_RESULT_ILLEGAL_OPERATION;
604 }
605 while (count > 0)
606 {
607 result = this->reserve_additional_id(this->id, &id);
608 if (result != TNC_RESULT_SUCCESS)
609 {
610 DBG1(DBG_IMC, "IMC %u \"%s\" failed to reserve %d additional IMC IDs",
611 this->id, this->name, count);
612 return result;
613 }
614 count--;
615
616 /* store the scalar value in the pointer */
617 pointer = (void*)id;
618 this->additional_ids->insert_last(this->additional_ids, pointer);
619 DBG2(DBG_IMC, "IMC %u \"%s\" reserved additional ID %u",
620 this->id, this->name, id);
621 }
622 return TNC_RESULT_SUCCESS;
623 }
624
625 METHOD(imc_agent_t, count_additional_ids, int,
626 private_imc_agent_t *this)
627 {
628 return this->additional_ids->get_count(this->additional_ids);
629 }
630
631 METHOD(imc_agent_t, create_id_enumerator, enumerator_t*,
632 private_imc_agent_t *this)
633 {
634 return this->additional_ids->create_enumerator(this->additional_ids);
635 }
636
637 METHOD(imc_agent_t, destroy, void,
638 private_imc_agent_t *this)
639 {
640 DBG1(DBG_IMC, "IMC %u \"%s\" terminated", this->id, this->name);
641 this->additional_ids->destroy(this->additional_ids);
642 this->connections->destroy_function(this->connections, free);
643 this->connection_lock->destroy(this->connection_lock);
644 free(this);
645
646 /* decrease the reference count or terminate */
647 libimcv_deinit();
648 }
649
650 /**
651 * Described in header.
652 */
653 imc_agent_t *imc_agent_create(const char *name,
654 pen_t vendor_id, u_int32_t subtype,
655 TNC_IMCID id, TNC_Version *actual_version)
656 {
657 private_imc_agent_t *this;
658
659 /* initialize or increase the reference count */
660 if (!libimcv_init())
661 {
662 return NULL;
663 }
664
665 INIT(this,
666 .public = {
667 .bind_functions = _bind_functions,
668 .create_state = _create_state,
669 .delete_state = _delete_state,
670 .change_state = _change_state,
671 .get_state = _get_state,
672 .send_message = _send_message,
673 .receive_message = _receive_message,
674 .reserve_additional_ids = _reserve_additional_ids,
675 .count_additional_ids = _count_additional_ids,
676 .create_id_enumerator = _create_id_enumerator,
677 .destroy = _destroy,
678 },
679 .name = name,
680 .vendor_id = vendor_id,
681 .subtype = subtype,
682 .id = id,
683 .additional_ids = linked_list_create(),
684 .connections = linked_list_create(),
685 .connection_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
686 );
687
688 *actual_version = TNC_IFIMC_VERSION_1;
689 DBG1(DBG_IMC, "IMC %u \"%s\" initialized", this->id, this->name);
690
691 return &this->public;
692 }
693