]>
git.saurik.com Git - apple/ipsec.git/blob - ipsec-tools/Common/ipsecMessageTracer.h
2 * Copyright (c) 2008 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _IPSECMESSAGETRACER_H
24 #define _IPSECMESSAGETRACER_H
28 #define CONSTSTR(str) (const char *)str
30 #define L2TPIPSECVPN_CONNECTION_ESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.disconnect.l2tpipsec")
31 #define CISCOIPSECVPN_CONNECTION_ESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.disconnect.ciscoipsec")
32 #define BTMMIPSEC_CONNECTION_ESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.disconnect.btmm")
33 #define PLAINIPSEC_CONNECTION_ESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.disconnect.plain")
34 #define L2TPIPSECVPN_CONNECTION_NOTESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.connect.l2tpipsec")
35 #define CISCOIPSECVPN_CONNECTION_NOTESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.connect.ciscoipsec")
36 #define BTMMIPSEC_CONNECTION_NOTESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.connect.btmm")
37 #define PLAINIPSEC_CONNECTION_NOTESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.connect.plain")
38 #define L2TPIPSECVPN_PHASE_DOMAIN CONSTSTR("com.apple.Networking.ipsec.phasestats.l2tpipsec")
39 #define CISCOIPSECVPN_PHASE_DOMAIN CONSTSTR("com.apple.Networking.ipsec.phasestats.ciscoipsec")
40 #define BTMMIPSEC_PHASE_DOMAIN CONSTSTR("com.apple.Networking.ipsec.phasestats.btmm")
41 #define PLAINIPSEC_PHASE_DOMAIN CONSTSTR("com.apple.Networking.ipsec.phasestats.plain")
42 #define PLAINIPSECDOMAIN CONSTSTR("com.apple.Networking.ipsec.main")
44 #define IPSECASLDOMAIN CONSTSTR("com.apple.Networking.ipsec.asl")
45 #define IPSECASLKEY CONSTSTR("IPSEC")
47 #if TARGET_OS_EMBEDDED
49 #define IPSECCONFIGTRACEREVENT(config, eventCode, message, failure_reason)
51 #define IPSECPOLICYTRACEREVENT(policy, eventCode, message, failure_reason)
53 #define IPSECSESSIONTRACERSTART(session)
54 #define IPSECSESSIONTRACEREVENT(session, eventCode, message, failure_reason)
55 #define IPSECSESSIONTRACERSTOP(session, is_failure, reason)
56 #define IPSECSESSIONTRACERESTABLISHED(session)
60 #define IPSECCONFIGTRACEREVENT(config, eventCode, message, failure_reason) ipsecConfigTracerEvent(config, eventCode, message, failure_reason)
62 #define IPSECPOLICYTRACEREVENT(policy, eventCode, message, failure_reason) ipsecPolicyTracerEvent(policy, eventCode, message, failure_reason)
64 #define IPSECSESSIONTRACERSTART(session) ipsecSessionTracerStart(session)
65 #define IPSECSESSIONTRACEREVENT(session, eventCode, message, failure_reason) ipsecSessionTracerEvent(session, eventCode, message, failure_reason)
66 #define IPSECSESSIONTRACERSTOP(session, is_failure, reason) ipsecSessionTracerStop(session, is_failure, reason)
67 #define IPSECSESSIONTRACERESTABLISHED(session) ipsecSessionTracerLogEstablished(session)
71 #if 1 //TARGET_OS_EMBEDDED
72 #define IPSECLOGASLMSG(format, args...) plog(ASL_LEVEL_NOTICE, format, ##args);
74 #define IPSECLOGASLMSG(format, args...) do { \
75 aslmsg m = asl_new(ASL_TYPE_MSG); \
76 asl_set(m, ASL_KEY_FACILITY, IPSECASLDOMAIN); \
77 asl_set(m, ASL_KEY_MSG, IPSECASLKEY); \
78 asl_log(NULL, m, ASL_LEVEL_NOTICE, format, ##args); \
83 static inline double get_percentage (double numerator
, double denominator
)
85 if (numerator
>= denominator
|| denominator
== 0) {
88 return((numerator
/denominator
)*100);
91 #endif /* _IPSECMESSAGETRACER_H */