+static void
+ip6fw_kev_post_msg(u_int32_t event_code)
+{
+ struct kev_msg ev_msg;
+
+ bzero(&ev_msg, sizeof(struct kev_msg));
+
+ ev_msg.vendor_code = KEV_VENDOR_APPLE;
+ ev_msg.kev_class = KEV_FIREWALL_CLASS;
+ ev_msg.kev_subclass = KEV_IP6FW_SUBCLASS;
+ ev_msg.event_code = event_code;
+
+ kev_post_msg(&ev_msg);
+
+}
+
+
+static void
+cp_to_user_64( struct ip6_fw_64 *userrule_64, struct ip6_fw *rule)
+{
+ userrule_64->version = rule->version;
+ userrule_64->context = CAST_USER_ADDR_T(rule->context);
+ userrule_64->fw_pcnt = rule->fw_pcnt;
+ userrule_64->fw_bcnt = rule->fw_bcnt;
+ userrule_64->fw_src = rule->fw_src;
+ userrule_64->fw_dst = rule->fw_dst;
+ userrule_64->fw_smsk = rule->fw_smsk;
+ userrule_64->fw_dmsk = rule->fw_dmsk;
+ userrule_64->fw_number = rule->fw_number;
+ userrule_64->fw_flg = rule->fw_flg;
+ userrule_64->fw_ipflg = rule->fw_ipflg;
+ bcopy( rule->fw_pts, userrule_64->fw_pts, IPV6_FW_MAX_PORTS);
+ userrule_64->fw_ip6opt= rule->fw_ip6opt;
+ userrule_64->fw_ip6nopt = rule->fw_ip6nopt;
+ userrule_64->fw_tcpf = rule->fw_tcpf;
+ userrule_64->fw_tcpnf = rule->fw_tcpnf;
+ bcopy( rule->fw_icmp6types, userrule_64->fw_icmp6types, sizeof(userrule_64->fw_icmp6types));
+ userrule_64->fw_in_if = rule->fw_in_if;
+ userrule_64->fw_out_if = rule->fw_out_if;
+ userrule_64->timestamp = rule->timestamp;
+ userrule_64->fw_un.fu_divert_port = rule->fw_un.fu_divert_port;
+ userrule_64->fw_prot = rule->fw_prot;
+ userrule_64->fw_nports = rule->fw_nports;
+}
+
+
+static void
+cp_from_user_64( struct ip6_fw_64 *userrule_64, struct ip6_fw *rule)
+{
+ rule->version = userrule_64->version;
+ rule->context = CAST_DOWN(void *, userrule_64->context);
+ rule->fw_pcnt = userrule_64->fw_pcnt;
+ rule->fw_bcnt = userrule_64->fw_bcnt;
+ rule->fw_src = userrule_64->fw_src;
+ rule->fw_dst = userrule_64->fw_dst;
+ rule->fw_smsk = userrule_64->fw_smsk;
+ rule->fw_dmsk = userrule_64->fw_dmsk;
+ rule->fw_number = userrule_64->fw_number;
+ rule->fw_flg = userrule_64->fw_flg;
+ rule->fw_ipflg = userrule_64->fw_ipflg;
+ bcopy( userrule_64->fw_pts, rule->fw_pts, IPV6_FW_MAX_PORTS);
+ rule->fw_ip6opt = userrule_64->fw_ip6opt;
+ rule->fw_ip6nopt = userrule_64->fw_ip6nopt;
+ rule->fw_tcpf = userrule_64->fw_tcpf;
+ rule->fw_tcpnf = userrule_64->fw_tcpnf;
+ bcopy( userrule_64->fw_icmp6types, rule->fw_icmp6types, sizeof(userrule_64->fw_icmp6types));
+ rule->fw_in_if = userrule_64->fw_in_if;
+ rule->fw_out_if = userrule_64->fw_out_if;
+ rule->timestamp = CAST_DOWN( long, userrule_64->timestamp);
+ rule->fw_un.fu_divert_port = userrule_64->fw_un.fu_divert_port;
+ rule->fw_prot = userrule_64->fw_prot;
+ rule->fw_nports = userrule_64->fw_nports;
+}
+
+
+static void
+cp_to_user_32( struct ip6_fw_32 *userrule_32, struct ip6_fw *rule)
+{
+ userrule_32->version = rule->version;
+ userrule_32->context = CAST_DOWN_EXPLICIT( user32_addr_t, rule->context);
+ userrule_32->fw_pcnt = rule->fw_pcnt;
+ userrule_32->fw_bcnt = rule->fw_bcnt;
+ userrule_32->fw_src = rule->fw_src;
+ userrule_32->fw_dst = rule->fw_dst;
+ userrule_32->fw_smsk = rule->fw_smsk;
+ userrule_32->fw_dmsk = rule->fw_dmsk;
+ userrule_32->fw_number = rule->fw_number;
+ userrule_32->fw_flg = rule->fw_flg;
+ userrule_32->fw_ipflg = rule->fw_ipflg;
+ bcopy( rule->fw_pts, userrule_32->fw_pts, IPV6_FW_MAX_PORTS);
+ userrule_32->fw_ip6opt = rule->fw_ip6opt ;
+ userrule_32->fw_ip6nopt = rule->fw_ip6nopt;
+ userrule_32->fw_tcpf = rule->fw_tcpf;
+ userrule_32->fw_tcpnf = rule->fw_tcpnf;
+ bcopy( rule->fw_icmp6types, userrule_32->fw_icmp6types, sizeof(rule->fw_icmp6types));
+ userrule_32->fw_in_if = rule->fw_in_if;
+ userrule_32->fw_out_if = rule->fw_out_if;
+ userrule_32->timestamp = rule->timestamp;
+ userrule_32->fw_un.fu_divert_port = rule->fw_un.fu_divert_port;
+ userrule_32->fw_prot = rule->fw_prot;
+ userrule_32->fw_nports = rule->fw_nports;
+}
+
+
+static void
+cp_from_user_32( struct ip6_fw_32 *userrule_32, struct ip6_fw *rule)
+{
+ rule->version = userrule_32->version;
+ rule->context = CAST_DOWN(void *, userrule_32->context);
+ rule->fw_pcnt = userrule_32->fw_pcnt;
+ rule->fw_bcnt = userrule_32->fw_bcnt;
+ rule->fw_src = userrule_32->fw_src;
+ rule->fw_dst = userrule_32->fw_dst;
+ rule->fw_smsk = userrule_32->fw_smsk;
+ rule->fw_dmsk = userrule_32->fw_dmsk;
+ rule->fw_number = userrule_32->fw_number;
+ rule->fw_flg = userrule_32->fw_flg;
+ rule->fw_ipflg = userrule_32->fw_ipflg;
+ bcopy( userrule_32->fw_pts, rule->fw_pts, IPV6_FW_MAX_PORTS);
+ rule->fw_ip6opt = userrule_32->fw_ip6opt;
+ rule->fw_ip6nopt = userrule_32->fw_ip6nopt;
+ rule->fw_tcpf = userrule_32->fw_tcpf;
+ rule->fw_tcpnf = userrule_32->fw_tcpnf;
+ bcopy( userrule_32->fw_icmp6types, rule->fw_icmp6types, sizeof(userrule_32->fw_icmp6types));
+ rule->fw_in_if = userrule_32->fw_in_if;
+ rule->fw_out_if = userrule_32->fw_out_if;
+ rule->timestamp = CAST_DOWN(long, userrule_32->timestamp);
+ rule->fw_un.fu_divert_port = userrule_32->fw_un.fu_divert_port;
+ rule->fw_prot = userrule_32->fw_prot;
+ rule->fw_nports = userrule_32->fw_nports;
+}
+