2 * Copyright (C) 2012-2013 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
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>.
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
16 #include "ipsec_types.h"
18 ENUM(ipsec_mode_names
, MODE_TRANSPORT
, MODE_DROP
,
26 ENUM(policy_dir_names
, POLICY_IN
, POLICY_FWD
,
32 ENUM(ipcomp_transform_names
, IPCOMP_NONE
, IPCOMP_LZJH
,
43 bool mark_from_string(const char *value
, mark_t
*mark
)
51 mark
->value
= strtoul(value
, &endptr
, 0);
56 DBG1(DBG_APP
, "invalid mark value: %s", value
);
59 mark
->mask
= strtoul(endptr
+1, &endptr
, 0);
62 DBG1(DBG_LIB
, "invalid mark mask: %s", endptr
);
68 mark
->mask
= 0xffffffff;
70 /* apply the mask to ensure the value is in range */
71 mark
->value
&= mark
->mask
;