]> git.saurik.com Git - apple/ipsec.git/blobdiff - ipsec-tools/Common/ipsecMessageTracer.h
ipsec-317.220.1.tar.gz
[apple/ipsec.git] / ipsec-tools / Common / ipsecMessageTracer.h
index 9a3f50a130288db80e7c29f85500593afa5ae913..051c54e076586fc3e52f0cb6c94680a1d8ade619 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef _IPSECMESSAGETRACER_H
 #define _IPSECMESSAGETRACER_H
 
+#import         <asl.h>
+
 #define CONSTSTR(str) (const char *)str
 
 #define L2TPIPSECVPN_CONNECTION_ESTABLISHED_DOMAIN                                                             CONSTSTR("com.apple.Networking.ipsec.disconnect.l2tpipsec")
@@ -39,6 +41,9 @@
 #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)             
 
 #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) {