X-Git-Url: https://git.saurik.com/apple/ipsec.git/blobdiff_plain/d1e348cfd503b08e7d34b7683d23aae209af0a71..d06a7ccbc5c7dbb1b65b08cfdbb7c4ec0824c666:/ipsec-tools/Common/ipsecMessageTracer.h diff --git a/ipsec-tools/Common/ipsecMessageTracer.h b/ipsec-tools/Common/ipsecMessageTracer.h index 14bafba..051c54e 100644 --- a/ipsec-tools/Common/ipsecMessageTracer.h +++ b/ipsec-tools/Common/ipsecMessageTracer.h @@ -23,6 +23,8 @@ #ifndef _IPSECMESSAGETRACER_H #define _IPSECMESSAGETRACER_H +#import + #define CONSTSTR(str) (const char *)str #define L2TPIPSECVPN_CONNECTION_ESTABLISHED_DOMAIN CONSTSTR("com.apple.Networking.ipsec.disconnect.l2tpipsec") @@ -39,6 +41,22 @@ #define PLAINIPSEC_PHASE_DOMAIN CONSTSTR("com.apple.Networking.ipsec.phasestats.plain") #define PLAINIPSECDOMAIN CONSTSTR("com.apple.Networking.ipsec.main") +#define IPSECASLDOMAIN CONSTSTR("com.apple.Networking.ipsec.asl") +#define IPSECASLKEY CONSTSTR("IPSEC") + +#if TARGET_OS_EMBEDDED + +#define IPSECCONFIGTRACEREVENT(config, eventCode, message, failure_reason) + +#define IPSECPOLICYTRACEREVENT(policy, eventCode, message, failure_reason) + +#define IPSECSESSIONTRACERSTART(session) +#define IPSECSESSIONTRACEREVENT(session, eventCode, message, failure_reason) +#define IPSECSESSIONTRACERSTOP(session, is_failure, reason) +#define IPSECSESSIONTRACERESTABLISHED(session) + +#else + #define IPSECCONFIGTRACEREVENT(config, eventCode, message, failure_reason) ipsecConfigTracerEvent(config, eventCode, message, failure_reason) #define IPSECPOLICYTRACEREVENT(policy, eventCode, message, failure_reason) ipsecPolicyTracerEvent(policy, eventCode, message, failure_reason) @@ -48,6 +66,20 @@ #define IPSECSESSIONTRACERSTOP(session, is_failure, reason) ipsecSessionTracerStop(session, is_failure, reason) #define IPSECSESSIONTRACERESTABLISHED(session) ipsecSessionTracerLogEstablished(session) +#endif + +#if 1 //TARGET_OS_EMBEDDED +#define IPSECLOGASLMSG(format, args...) plog(ASL_LEVEL_NOTICE, format, ##args); +#else +#define IPSECLOGASLMSG(format, args...) do { \ + aslmsg m = asl_new(ASL_TYPE_MSG); \ + asl_set(m, ASL_KEY_FACILITY, IPSECASLDOMAIN); \ + asl_set(m, ASL_KEY_MSG, IPSECASLKEY); \ + asl_log(NULL, m, ASL_LEVEL_NOTICE, format, ##args); \ + asl_free(m); \ + } while(0) +#endif + static inline double get_percentage (double numerator, double denominator) { if (numerator >= denominator || denominator == 0) {