show authentication method in ipsec statusall
[strongswan.git] / src / charon / plugins / stroke / stroke_list.c
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
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>.
9 *
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
13 * for more details.
14 *
15 * $Id$
16 */
17
18 #include "stroke_list.h"
19
20 #include <daemon.h>
21 #include <utils/linked_list.h>
22 #include <credentials/certificates/x509.h>
23 #include <credentials/certificates/ac.h>
24 #include <credentials/certificates/crl.h>
25 #include <config/peer_cfg.h>
26
27 /* warning intervals for list functions */
28 #define CERT_WARNING_INTERVAL 30 /* days */
29 #define CRL_WARNING_INTERVAL 7 /* days */
30 #define AC_WARNING_INTERVAL 1 /* day */
31
32 typedef struct private_stroke_list_t private_stroke_list_t;
33
34 /**
35 * private data of stroke_list
36 */
37 struct private_stroke_list_t {
38
39 /**
40 * public functions
41 */
42 stroke_list_t public;
43
44 /**
45 * timestamp of daemon start
46 */
47 time_t uptime;
48 };
49
50 /**
51 * log an IKE_SA to out
52 */
53 static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all)
54 {
55 ike_sa_id_t *id = ike_sa->get_id(ike_sa);
56
57 fprintf(out, "%12s[%d]: %N, %H[%D]...%H[%D]\n",
58 ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
59 ike_sa_state_names, ike_sa->get_state(ike_sa),
60 ike_sa->get_my_host(ike_sa), ike_sa->get_my_id(ike_sa),
61 ike_sa->get_other_host(ike_sa), ike_sa->get_other_id(ike_sa));
62
63 if (all)
64 {
65 char *ike_proposal = ike_sa->get_proposal(ike_sa);
66
67 fprintf(out, "%12s[%d]: IKE SPIs: %.16llx_i%s %.16llx_r%s",
68 ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
69 id->get_initiator_spi(id), id->is_initiator(id) ? "*" : "",
70 id->get_responder_spi(id), id->is_initiator(id) ? "" : "*");
71
72
73 if (ike_sa->get_state(ike_sa) == IKE_ESTABLISHED)
74 {
75 u_int32_t rekey = ike_sa->get_statistic(ike_sa, STAT_REKEY_TIME);
76 u_int32_t reauth = ike_sa->get_statistic(ike_sa, STAT_REAUTH_TIME);
77
78 if (rekey)
79 {
80 fprintf(out, ", rekeying in %V", &rekey);
81 }
82 if (reauth)
83 {
84 peer_cfg_t *peer_cfg = ike_sa->get_peer_cfg(ike_sa);
85
86 fprintf(out, ", %N reauthentication in %V",
87 config_auth_method_names,
88 peer_cfg->get_auth_method(peer_cfg),
89 &reauth);
90 }
91 if (!rekey && !reauth)
92 {
93 fprintf(out, ", rekeying disabled");
94 }
95 }
96 fprintf(out, "\n");
97
98 if (ike_proposal)
99 {
100 fprintf(out, "%12s[%d]: IKE proposal: %s\n",
101 ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa),
102 ike_proposal);
103 }
104 }
105 }
106
107 /**
108 * log an CHILD_SA to out
109 */
110 static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
111 {
112 u_int32_t rekey, now = time(NULL);
113 u_int32_t use_in, use_out, use_fwd;
114 encryption_algorithm_t encr_alg;
115 integrity_algorithm_t int_alg;
116 size_t encr_len, int_len;
117 mode_t mode;
118
119 child_sa->get_stats(child_sa, &mode, &encr_alg, &encr_len,
120 &int_alg, &int_len, &rekey, &use_in, &use_out,
121 &use_fwd);
122
123 fprintf(out, "%12s{%d}: %N, %N",
124 child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
125 child_sa_state_names, child_sa->get_state(child_sa),
126 mode_names, mode);
127
128 if (child_sa->get_state(child_sa) == CHILD_INSTALLED)
129 {
130 fprintf(out, ", %N SPIs: %.8x_i %.8x_o",
131 protocol_id_names, child_sa->get_protocol(child_sa),
132 htonl(child_sa->get_spi(child_sa, TRUE)),
133 htonl(child_sa->get_spi(child_sa, FALSE)));
134
135 if (all)
136 {
137 fprintf(out, "\n%12s{%d}: ", child_sa->get_name(child_sa),
138 child_sa->get_reqid(child_sa));
139
140
141 if (child_sa->get_protocol(child_sa) == PROTO_ESP)
142 {
143 fprintf(out, "%N", encryption_algorithm_names, encr_alg);
144
145 if (encr_len)
146 {
147 fprintf(out, "-%d", encr_len);
148 }
149 if (int_alg != AUTH_UNDEFINED)
150 {
151 fprintf(out, "/");
152 }
153 }
154
155 if (int_alg != AUTH_UNDEFINED)
156 {
157 fprintf(out, "%N", integrity_algorithm_names, int_alg);
158 if (int_len)
159 {
160 fprintf(out, "-%d", int_len);
161 }
162 }
163 fprintf(out, ", rekeying ");
164
165 if (rekey)
166 {
167 fprintf(out, "in %#V", &now, &rekey);
168 }
169 else
170 {
171 fprintf(out, "disabled");
172 }
173
174 fprintf(out, ", last use: ");
175 use_in = max(use_in, use_fwd);
176 if (use_in)
177 {
178 fprintf(out, "%ds_i ", now - use_in);
179 }
180 else
181 {
182 fprintf(out, "no_i ");
183 }
184 if (use_out)
185 {
186 fprintf(out, "%ds_o ", now - use_out);
187 }
188 else
189 {
190 fprintf(out, "no_o ");
191 }
192 }
193 }
194
195 fprintf(out, "\n%12s{%d}: %#R=== %#R\n",
196 child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
197 child_sa->get_traffic_selectors(child_sa, TRUE),
198 child_sa->get_traffic_selectors(child_sa, FALSE));
199 }
200
201 /**
202 * Implementation of stroke_list_t.status.
203 */
204 static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bool all)
205 {
206 enumerator_t *enumerator, *children;
207 iterator_t *iterator;
208 host_t *host;
209 peer_cfg_t *peer_cfg;
210 ike_cfg_t *ike_cfg;
211 child_cfg_t *child_cfg;
212 ike_sa_t *ike_sa;
213 char *name = NULL, *plugin;
214 bool found = FALSE;
215 time_t uptime;
216
217 name = msg->status.name;
218
219 if (all)
220 {
221 uptime = time(NULL) - this->uptime;
222 fprintf(out, "Performance:\n");
223 fprintf(out, " uptime: %V, since %#T\n", &uptime, &this->uptime, FALSE);
224 fprintf(out, " worker threads: %d idle of %d,",
225 charon->processor->get_idle_threads(charon->processor),
226 charon->processor->get_total_threads(charon->processor));
227 fprintf(out, " job queue load: %d,",
228 charon->processor->get_job_load(charon->processor));
229 fprintf(out, " scheduled events: %d\n",
230 charon->scheduler->get_job_load(charon->scheduler));
231 fprintf(out, " loaded plugins: ");
232 enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
233 while (enumerator->enumerate(enumerator, &plugin))
234 {
235 fprintf(out, "%s ", plugin);
236 }
237 enumerator->destroy(enumerator);
238 fprintf(out, "\n");
239
240 iterator = charon->kernel_interface->create_address_iterator(
241 charon->kernel_interface);
242 fprintf(out, "Listening IP addresses:\n");
243 while (iterator->iterate(iterator, (void**)&host))
244 {
245 fprintf(out, " %H\n", host);
246 }
247 iterator->destroy(iterator);
248
249 fprintf(out, "Connections:\n");
250 enumerator = charon->backends->create_peer_cfg_enumerator(charon->backends);
251 while (enumerator->enumerate(enumerator, (void**)&peer_cfg))
252 {
253 if (peer_cfg->get_ike_version(peer_cfg) != 2 ||
254 (name && !streq(name, peer_cfg->get_name(peer_cfg))))
255 {
256 continue;
257 }
258
259 ike_cfg = peer_cfg->get_ike_cfg(peer_cfg);
260 fprintf(out, "%12s: %s[%D]...%s[%D]\n", peer_cfg->get_name(peer_cfg),
261 ike_cfg->get_my_addr(ike_cfg), peer_cfg->get_my_id(peer_cfg),
262 ike_cfg->get_other_addr(ike_cfg), peer_cfg->get_other_id(peer_cfg));
263 fprintf(out, "%12s: %N authentication\n", peer_cfg->get_name(peer_cfg),
264 config_auth_method_names, peer_cfg->get_auth_method(peer_cfg));
265 /* TODO: list CAs and groups */
266 children = peer_cfg->create_child_cfg_enumerator(peer_cfg);
267 while (children->enumerate(children, &child_cfg))
268 {
269 linked_list_t *my_ts, *other_ts;
270 my_ts = child_cfg->get_traffic_selectors(child_cfg, TRUE, NULL, NULL);
271 other_ts = child_cfg->get_traffic_selectors(child_cfg, FALSE, NULL, NULL);
272 fprintf(out, "%12s: %#R=== %#R\n", child_cfg->get_name(child_cfg),
273 my_ts, other_ts);
274 my_ts->destroy_offset(my_ts, offsetof(traffic_selector_t, destroy));
275 other_ts->destroy_offset(other_ts, offsetof(traffic_selector_t, destroy));
276 }
277 children->destroy(children);
278 }
279 enumerator->destroy(enumerator);
280 }
281
282 fprintf(out, "Security Associations:\n");
283 enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
284 while (enumerator->enumerate(enumerator, &ike_sa))
285 {
286 bool ike_printed = FALSE;
287 child_sa_t *child_sa;
288 iterator_t *children = ike_sa->create_child_sa_iterator(ike_sa);
289
290 if (name == NULL || streq(name, ike_sa->get_name(ike_sa)))
291 {
292 log_ike_sa(out, ike_sa, all);
293 found = TRUE;
294 ike_printed = TRUE;
295 }
296
297 while (children->iterate(children, (void**)&child_sa))
298 {
299 if (name == NULL || streq(name, child_sa->get_name(child_sa)))
300 {
301 if (!ike_printed)
302 {
303 log_ike_sa(out, ike_sa, all);
304 found = TRUE;
305 ike_printed = TRUE;
306 }
307 log_child_sa(out, child_sa, all);
308 }
309 }
310 children->destroy(children);
311 }
312 enumerator->destroy(enumerator);
313
314 if (!found)
315 {
316 if (name)
317 {
318 fprintf(out, " no match\n");
319 }
320 else
321 {
322 fprintf(out, " none\n");
323 }
324 }
325 }
326
327 /**
328 * create a unique certificate list without duplicates
329 * certicates having the same issuer are grouped together.
330 */
331 static linked_list_t* create_unique_cert_list(certificate_type_t type)
332 {
333 linked_list_t *list = linked_list_create();
334 enumerator_t *enumerator = charon->credentials->create_cert_enumerator(
335 charon->credentials, type, KEY_ANY,
336 NULL, FALSE);
337 certificate_t *cert;
338
339 while (enumerator->enumerate(enumerator, (void**)&cert))
340 {
341 iterator_t *iterator = list->create_iterator(list, TRUE);
342 identification_t *issuer = cert->get_issuer(cert);
343 bool previous_same, same = FALSE, last = TRUE;
344 certificate_t *list_cert;
345
346 while (iterator->iterate(iterator, (void**)&list_cert))
347 {
348 /* exit if we have a duplicate? */
349 if (list_cert->equals(list_cert, cert))
350 {
351 last = FALSE;
352 break;
353 }
354 /* group certificates with same issuer */
355 previous_same = same;
356 same = list_cert->has_issuer(list_cert, issuer);
357 if (previous_same && !same)
358 {
359 iterator->insert_before(iterator, (void *)cert->get_ref(cert));
360 last = FALSE;
361 break;
362 }
363 }
364 iterator->destroy(iterator);
365
366 if (last)
367 {
368 list->insert_last(list, (void *)cert->get_ref(cert));
369 }
370 }
371 enumerator->destroy(enumerator);
372 return list;
373 }
374
375 /**
376 * list all X.509 certificates matching the flags
377 */
378 static void stroke_list_certs(linked_list_t *list, char *label,
379 x509_flag_t flags, bool utc, FILE *out)
380 {
381 bool first = TRUE;
382 time_t now = time(NULL);
383 enumerator_t *enumerator = list->create_enumerator(list);
384 certificate_t *cert;
385
386 while (enumerator->enumerate(enumerator, (void**)&cert))
387 {
388 x509_t *x509 = (x509_t*)cert;
389 x509_flag_t x509_flags = x509->get_flags(x509);
390
391 /* list only if flag is set, or flags == 0 (ignoring self-signed) */
392 if ((x509_flags & flags) || (flags == (x509_flags & ~X509_SELF_SIGNED)))
393 {
394 enumerator_t *enumerator;
395 identification_t *altName;
396 bool first_altName = TRUE;
397 chunk_t serial = x509->get_serial(x509);
398 identification_t *authkey = x509->get_authKeyIdentifier(x509);
399 time_t notBefore, notAfter;
400 public_key_t *public = cert->get_public_key(cert);
401
402 if (first)
403 {
404 fprintf(out, "\n");
405 fprintf(out, "List of %s:\n", label);
406 first = FALSE;
407 }
408 fprintf(out, "\n");
409
410 /* list subjectAltNames */
411 enumerator = x509->create_subjectAltName_enumerator(x509);
412 while (enumerator->enumerate(enumerator, (void**)&altName))
413 {
414 if (first_altName)
415 {
416 fprintf(out, " altNames: ");
417 first_altName = FALSE;
418 }
419 else
420 {
421 fprintf(out, ", ");
422 }
423 fprintf(out, "%D", altName);
424 }
425 if (!first_altName)
426 {
427 fprintf(out, "\n");
428 }
429 enumerator->destroy(enumerator);
430
431 fprintf(out, " subject: \"%D\"\n", cert->get_subject(cert));
432 fprintf(out, " issuer: \"%D\"\n", cert->get_issuer(cert));
433 fprintf(out, " serial: %#B\n", &serial);
434
435 /* list validity */
436 cert->get_validity(cert, &now, &notBefore, &notAfter);
437 fprintf(out, " validity: not before %#T, ", &notBefore, utc);
438 if (now < notBefore)
439 {
440 fprintf(out, "not valid yet (valid in %#V)\n", &now, &notBefore);
441 }
442 else
443 {
444 fprintf(out, "ok\n");
445 }
446 fprintf(out, " not after %#T, ", &notAfter, utc);
447 if (now > notAfter)
448 {
449 fprintf(out, "expired (%#V ago)\n", &now, &notAfter);
450 }
451 else
452 {
453 fprintf(out, "ok");
454 if (now > notAfter - CERT_WARNING_INTERVAL * 60 * 60 * 24)
455 {
456 fprintf(out, " (expires in %#V)", &now, &notAfter);
457 }
458 fprintf(out, " \n");
459 }
460
461 /* list public key information */
462 if (public)
463 {
464 private_key_t *private = NULL;
465 identification_t *id, *keyid;
466
467 id = public->get_id(public, ID_PUBKEY_SHA1);
468 keyid = public->get_id(public, ID_PUBKEY_INFO_SHA1);
469
470 private = charon->credentials->get_private(
471 charon->credentials,
472 public->get_type(public), keyid, NULL);
473 fprintf(out, " pubkey: %N %d bits%s\n",
474 key_type_names, public->get_type(public),
475 public->get_keysize(public) * 8,
476 private ? ", has private key" : "");
477 fprintf(out, " keyid: %D\n", keyid);
478 fprintf(out, " subjkey: %D\n", id);
479 DESTROY_IF(private);
480 public->destroy(public);
481 }
482
483 /* list optional authorityKeyIdentifier */
484 if (authkey)
485 {
486 fprintf(out, " authkey: %D\n", authkey);
487 }
488 }
489 }
490 enumerator->destroy(enumerator);
491 }
492
493 /**
494 * list all X.509 attribute certificates
495 */
496 static void stroke_list_acerts(linked_list_t *list, bool utc, FILE *out)
497 {
498 bool first = TRUE;
499 time_t thisUpdate, nextUpdate, now = time(NULL);
500 enumerator_t *enumerator = list->create_enumerator(list);
501 certificate_t *cert;
502
503 while (enumerator->enumerate(enumerator, (void**)&cert))
504 {
505 ac_t *ac = (ac_t*)cert;
506 chunk_t serial = ac->get_serial(ac);
507 chunk_t holderSerial = ac->get_holderSerial(ac);
508 identification_t *holderIssuer = ac->get_holderIssuer(ac);
509 identification_t *authkey = ac->get_authKeyIdentifier(ac);
510 identification_t *entityName = cert->get_subject(cert);
511
512 if (first)
513 {
514 fprintf(out, "\n");
515 fprintf(out, "List of X.509 Attribute Certificates:\n");
516 first = FALSE;
517 }
518 fprintf(out, "\n");
519
520 if (entityName)
521 {
522 fprintf(out, " holder: \"%D\"\n", entityName);
523 }
524 if (holderIssuer)
525 {
526 fprintf(out, " hissuer: \"%D\"\n", holderIssuer);
527 }
528 if (holderSerial.ptr)
529 {
530 fprintf(out, " hserial: %#B\n", &holderSerial);
531 }
532 fprintf(out, " issuer: \"%D\"\n", cert->get_issuer(cert));
533 fprintf(out, " serial: %#B\n", &serial);
534
535 /* list validity */
536 cert->get_validity(cert, &now, &thisUpdate, &nextUpdate);
537 fprintf(out, " updates: this %#T\n", &thisUpdate, utc);
538 fprintf(out, " next %#T, ", &nextUpdate, utc);
539 if (now > nextUpdate)
540 {
541 fprintf(out, "expired (%#V ago)\n", &now, &nextUpdate);
542 }
543 else
544 {
545 fprintf(out, "ok");
546 if (now > nextUpdate - AC_WARNING_INTERVAL * 60 * 60 * 24)
547 {
548 fprintf(out, " (expires in %#V)", &now, &nextUpdate);
549 }
550 fprintf(out, " \n");
551 }
552
553 /* list optional authorityKeyIdentifier */
554 if (authkey)
555 {
556 fprintf(out, " authkey: %D\n", authkey);
557 }
558 }
559 enumerator->destroy(enumerator);
560 }
561
562 /**
563 * list all X.509 CRLs
564 */
565 static void stroke_list_crls(linked_list_t *list, bool utc, FILE *out)
566 {
567 bool first = TRUE;
568 time_t thisUpdate, nextUpdate, now = time(NULL);
569 enumerator_t *enumerator = list->create_enumerator(list);
570 certificate_t *cert;
571
572 while (enumerator->enumerate(enumerator, (void**)&cert))
573 {
574 crl_t *crl = (crl_t*)cert;
575 chunk_t serial = crl->get_serial(crl);
576 identification_t *authkey = crl->get_authKeyIdentifier(crl);
577
578 if (first)
579 {
580 fprintf(out, "\n");
581 fprintf(out, "List of X.509 CRLs:\n");
582 first = FALSE;
583 }
584 fprintf(out, "\n");
585
586 fprintf(out, " issuer: \"%D\"\n", cert->get_issuer(cert));
587
588 /* list optional crlNumber */
589 if (serial.ptr)
590 {
591 fprintf(out, " serial: %#B\n", &serial);
592 }
593
594 /* count the number of revoked certificates */
595 {
596 int count = 0;
597 enumerator_t *enumerator = crl->create_enumerator(crl);
598
599 while (enumerator->enumerate(enumerator, NULL, NULL, NULL))
600 {
601 count++;
602 }
603 fprintf(out, " revoked: %d certificate%s\n", count,
604 (count == 1)? "" : "s");
605 enumerator->destroy(enumerator);
606 }
607
608 /* list validity */
609 cert->get_validity(cert, &now, &thisUpdate, &nextUpdate);
610 fprintf(out, " updates: this %#T\n", &thisUpdate, utc);
611 fprintf(out, " next %#T, ", &nextUpdate, utc);
612 if (now > nextUpdate)
613 {
614 fprintf(out, "expired (%#V ago)\n", &now, &nextUpdate);
615 }
616 else
617 {
618 fprintf(out, "ok");
619 if (now > nextUpdate - CRL_WARNING_INTERVAL * 60 * 60 * 24)
620 {
621 fprintf(out, " (expires in %#V)", &now, &nextUpdate);
622 }
623 fprintf(out, " \n");
624 }
625
626 /* list optional authorityKeyIdentifier */
627 if (authkey)
628 {
629 fprintf(out, " authkey: %D\n", authkey);
630 }
631 }
632 enumerator->destroy(enumerator);
633 }
634
635 /**
636 * list all OCSP responses
637 */
638 static void stroke_list_ocsp(linked_list_t* list, bool utc, FILE *out)
639 {
640 bool first = TRUE;
641 enumerator_t *enumerator = list->create_enumerator(list);
642 certificate_t *cert;
643
644 while (enumerator->enumerate(enumerator, (void**)&cert))
645 {
646 if (first)
647 {
648 fprintf(out, "\n");
649 fprintf(out, "List of OCSP responses:\n");
650 fprintf(out, "\n");
651 first = FALSE;
652 }
653
654 fprintf(out, " signer: \"%D\"\n", cert->get_issuer(cert));
655 }
656 enumerator->destroy(enumerator);
657 }
658
659 /**
660 * Implementation of stroke_list_t.list.
661 */
662 static void list(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
663 {
664 linked_list_t *cert_list = NULL;
665
666 if (msg->list.flags & (LIST_CERTS | LIST_CACERTS | LIST_OCSPCERTS | LIST_AACERTS))
667 {
668 cert_list = create_unique_cert_list(CERT_X509);
669 }
670 if (msg->list.flags & LIST_CERTS)
671 {
672 stroke_list_certs(cert_list, "X.509 End Entity Certificates",
673 0, msg->list.utc, out);
674 }
675 if (msg->list.flags & LIST_CACERTS)
676 {
677 stroke_list_certs(cert_list, "X.509 CA Certificates",
678 X509_CA, msg->list.utc, out);
679 }
680 if (msg->list.flags & LIST_OCSPCERTS)
681 {
682 stroke_list_certs(cert_list, "X.509 OCSP Signer Certificates",
683 X509_OCSP_SIGNER, msg->list.utc, out);
684 }
685 if (msg->list.flags & LIST_AACERTS)
686 {
687 stroke_list_certs(cert_list, "X.509 AA Certificates",
688 X509_AA, msg->list.utc, out);
689 }
690 if (msg->list.flags & LIST_ACERTS)
691 {
692 linked_list_t *ac_list = create_unique_cert_list(CERT_X509_AC);
693
694 stroke_list_acerts(ac_list, msg->list.utc, out);
695 ac_list->destroy_offset(ac_list, offsetof(certificate_t, destroy));
696 }
697 if (msg->list.flags & LIST_CRLS)
698 {
699 linked_list_t *crl_list = create_unique_cert_list(CERT_X509_CRL);
700
701 stroke_list_crls(crl_list, msg->list.utc, out);
702 crl_list->destroy_offset(crl_list, offsetof(certificate_t, destroy));
703 }
704 if (msg->list.flags & LIST_OCSP)
705 {
706 linked_list_t *ocsp_list = create_unique_cert_list(CERT_X509_OCSP_RESPONSE);
707
708 stroke_list_ocsp(ocsp_list, msg->list.utc, out);
709 ocsp_list->destroy_offset(ocsp_list, offsetof(certificate_t, destroy));
710 }
711 DESTROY_OFFSET_IF(cert_list, offsetof(certificate_t, destroy));
712 }
713
714 /**
715 * Implementation of stroke_list_t.destroy
716 */
717 static void destroy(private_stroke_list_t *this)
718 {
719 free(this);
720 }
721
722 /*
723 * see header file
724 */
725 stroke_list_t *stroke_list_create()
726 {
727 private_stroke_list_t *this = malloc_thing(private_stroke_list_t);
728
729 this->public.list = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out))list;
730 this->public.status = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out,bool))status;
731 this->public.destroy = (void(*)(stroke_list_t*))destroy;
732
733 this->uptime = time(NULL);
734
735 return &this->public;
736 }
737