]>
Commit | Line | Data |
---|---|---|
997358a6 MW |
1 | /* strongSwan IPsec starter comparison functions |
2 | * Copyright (C) 2001-2002 Mathieu Lafon - Arkoon Network Security | |
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. | |
997358a6 MW |
13 | */ |
14 | ||
15 | #include <string.h> | |
16 | ||
997358a6 MW |
17 | #include "confread.h" |
18 | #include "args.h" | |
997358a6 MW |
19 | #include "cmp.h" |
20 | ||
21 | #define VARCMP(obj) if (c1->obj != c2->obj) return FALSE | |
cdcfe777 | 22 | #define STRCMP(obj) if (strcmp(c1->obj,c2->obj)) return FALSE |
997358a6 | 23 | |
3e2ff81e | 24 | static bool starter_cmp_end(starter_end_t *c1, starter_end_t *c2) |
997358a6 | 25 | { |
3d7a244b AS |
26 | if ((c1 == NULL) || (c2 == NULL)) |
27 | return FALSE; | |
28 | ||
3d7a244b | 29 | VARCMP(modecfg); |
cd41b951 MW |
30 | VARCMP(from_port); |
31 | VARCMP(to_port); | |
3d7a244b AS |
32 | VARCMP(protocol); |
33 | ||
34 | return cmp_args(KW_END_FIRST, KW_END_LAST, (char *)c1, (char *)c2); | |
8dd094e1 | 35 | } |
997358a6 | 36 | |
3e2ff81e | 37 | bool starter_cmp_conn(starter_conn_t *c1, starter_conn_t *c2) |
997358a6 | 38 | { |
3d7a244b AS |
39 | if ((c1 == NULL) || (c2 == NULL)) |
40 | return FALSE; | |
997358a6 | 41 | |
4d218469 TB |
42 | VARCMP(mode); |
43 | VARCMP(proxy_mode); | |
5b09310e | 44 | VARCMP(options); |
ff090f87 AS |
45 | VARCMP(mark_in.value); |
46 | VARCMP(mark_in.mask); | |
47 | VARCMP(mark_out.value); | |
aa71c19e | 48 | VARCMP(mark_out.mask); |
4d218469 TB |
49 | VARCMP(tfc); |
50 | VARCMP(sa_keying_tries); | |
997358a6 | 51 | |
3d7a244b AS |
52 | if (!starter_cmp_end(&c1->left, &c2->left)) |
53 | return FALSE; | |
54 | if (!starter_cmp_end(&c1->right, &c2->right)) | |
55 | return FALSE; | |
997358a6 | 56 | |
3d7a244b | 57 | return cmp_args(KW_CONN_NAME, KW_CONN_LAST, (char *)c1, (char *)c2); |
997358a6 MW |
58 | } |
59 | ||
3e2ff81e | 60 | bool starter_cmp_ca(starter_ca_t *c1, starter_ca_t *c2) |
997358a6 | 61 | { |
3d7a244b AS |
62 | if (c1 == NULL || c2 == NULL) |
63 | return FALSE; | |
997358a6 | 64 | |
3d7a244b | 65 | return cmp_args(KW_CA_NAME, KW_CA_LAST, (char *)c1, (char *)c2); |
997358a6 | 66 | } |