require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_NET_IF_PFSYNC_H_)) {
    eval 'sub _NET_IF_PFSYNC_H_ () {1;}' unless defined(&_NET_IF_PFSYNC_H_);
    eval 'sub PFSYNC_ID_LEN () {$sizeof{ &u_int64_t};}' unless defined(&PFSYNC_ID_LEN);
    eval 'sub PFSYNC_SCRUB_FLAG_VALID () {0x1;}' unless defined(&PFSYNC_SCRUB_FLAG_VALID);
    eval 'sub PFSYNC_FLAG_COMPRESS () {0x1;}' unless defined(&PFSYNC_FLAG_COMPRESS);
    eval 'sub PFSYNC_FLAG_STALE () {0x2;}' unless defined(&PFSYNC_FLAG_STALE);
    eval 'sub PFSYNC_BUS_START () {1;}' unless defined(&PFSYNC_BUS_START);
    eval 'sub PFSYNC_BUS_END () {2;}' unless defined(&PFSYNC_BUS_END);
    if(defined(&_KERNEL)) {
    }
    eval 'sub PFSYNC_VERSION () {3;}' unless defined(&PFSYNC_VERSION);
    eval 'sub PFSYNC_ACT_CLR () {0;}' unless defined(&PFSYNC_ACT_CLR);
    eval 'sub PFSYNC_ACT_INS () {1;}' unless defined(&PFSYNC_ACT_INS);
    eval 'sub PFSYNC_ACT_UPD () {2;}' unless defined(&PFSYNC_ACT_UPD);
    eval 'sub PFSYNC_ACT_DEL () {3;}' unless defined(&PFSYNC_ACT_DEL);
    eval 'sub PFSYNC_ACT_UPD_C () {4;}' unless defined(&PFSYNC_ACT_UPD_C);
    eval 'sub PFSYNC_ACT_DEL_C () {5;}' unless defined(&PFSYNC_ACT_DEL_C);
    eval 'sub PFSYNC_ACT_INS_F () {6;}' unless defined(&PFSYNC_ACT_INS_F);
    eval 'sub PFSYNC_ACT_DEL_F () {7;}' unless defined(&PFSYNC_ACT_DEL_F);
    eval 'sub PFSYNC_ACT_UREQ () {8;}' unless defined(&PFSYNC_ACT_UREQ);
    eval 'sub PFSYNC_ACT_BUS () {9;}' unless defined(&PFSYNC_ACT_BUS);
    eval 'sub PFSYNC_ACT_TDB_UPD () {10;}' unless defined(&PFSYNC_ACT_TDB_UPD);
    eval 'sub PFSYNC_ACT_MAX () {11;}' unless defined(&PFSYNC_ACT_MAX);
    eval 'sub PFSYNC_BULKPACKETS () {1;}' unless defined(&PFSYNC_BULKPACKETS);
    eval 'sub PFSYNC_MAX_BULKTRIES () {12;}' unless defined(&PFSYNC_MAX_BULKTRIES);
    eval 'sub PFSYNC_HDRLEN () {$sizeof{\'struct pfsync_header\'};}' unless defined(&PFSYNC_HDRLEN);
    eval 'sub PFSYNC_ACTIONS () {"CLR ST", "INS ST", "UPD ST", "DEL ST", "UPD ST COMP", "DEL ST COMP", "INS FR", "DEL FR", "UPD REQ", "BLK UPD STAT", "TDB UPD";}' unless defined(&PFSYNC_ACTIONS);
    eval 'sub PFSYNC_DFLTTL () {255;}' unless defined(&PFSYNC_DFLTTL);
    eval 'sub pf_state_peer_hton {
        my($s,$d) = @_;
	    eval q( &do { ($d)-> &seqlo =  &htonl(($s)-> &seqlo); ($d)-> &seqhi =  &htonl(($s)-> &seqhi); ($d)-> &seqdiff =  &htonl(($s)-> &seqdiff); ($d)-> &max_win =  &htons(($s)-> &max_win); ($d)-> &mss =  &htons(($s)-> &mss); ($d)-> &state = ($s)-> &state; ($d)-> &wscale = ($s)-> &wscale;  &if (($s)-> &scrub) { ($d)-> ($scrub->{pfss_flags}) =  &htons(($s)-> ($scrub->{pfss_flags}) &  &PFSS_TIMESTAMP); ($d)-> ($scrub->{pfss_ttl}) = ($s)-> ($scrub->{pfss_ttl}); ($d)-> ($scrub->{pfss_ts_mod}) =  &htonl(($s)-> ($scrub->{pfss_ts_mod})); ($d)-> ($scrub->{scrub_flag}) =  &PFSYNC_SCRUB_FLAG_VALID; } }  &while (0));
    }' unless defined(&pf_state_peer_hton);
    eval 'sub pf_state_peer_ntoh {
        my($s,$d) = @_;
	    eval q( &do { ($d)-> &seqlo =  &ntohl(($s)-> &seqlo); ($d)-> &seqhi =  &ntohl(($s)-> &seqhi); ($d)-> &seqdiff =  &ntohl(($s)-> &seqdiff); ($d)-> &max_win =  &ntohs(($s)-> &max_win); ($d)-> &mss =  &ntohs(($s)-> &mss); ($d)-> &state = ($s)-> &state; ($d)-> &wscale = ($s)-> &wscale;  &if (($s)-> ($scrub->{scrub_flag}) ==  &PFSYNC_SCRUB_FLAG_VALID  && ($d)-> &scrub !=  &NULL) { ($d)-> ($scrub->{pfss_flags}) =  &ntohs(($s)-> ($scrub->{pfss_flags})) &  &PFSS_TIMESTAMP; ($d)-> ($scrub->{pfss_ttl}) = ($s)-> ($scrub->{pfss_ttl}); ($d)-> ($scrub->{pfss_ts_mod}) =  &ntohl(($s)-> ($scrub->{pfss_ts_mod})); } }  &while (0));
    }' unless defined(&pf_state_peer_ntoh);
    eval 'sub pf_state_host_hton {
        my($s,$d) = @_;
	    eval q( &do {  &bcopy(($s)-> &addr, ($d)-> &addr, $sizeof{($d)-> &addr}); ($d)-> &port = ($s)-> &port; }  &while (0));
    }' unless defined(&pf_state_host_hton);
    eval 'sub pf_state_host_ntoh {
        my($s,$d) = @_;
	    eval q( &do {  &bcopy(($s)-> &addr, ($d)-> &addr, $sizeof{($d)-> &addr}); ($d)-> &port = ($s)-> &port; }  &while (0));
    }' unless defined(&pf_state_host_ntoh);
    eval 'sub pf_state_counter_hton {
        my($s,$d) = @_;
	    eval q( &do { $d->[0] =  &htonl(($s>>32)&0xffffffff); $d->[1] =  &htonl($s&0xffffffff); }  &while (0));
    }' unless defined(&pf_state_counter_hton);
    eval 'sub pf_state_counter_ntoh {
        my($s,$d) = @_;
	    eval q( &do { $d =  &ntohl($s->[0]); $d = $d<<32; $d +=  &ntohl($s->[1]); }  &while (0));
    }' unless defined(&pf_state_counter_ntoh);
    if(defined(&_KERNEL)) {
	eval 'sub pfsync_insert_state {
	    my($st) = @_;
    	    eval q( &do {  &if (( ($st->{rule}->{ptr}->{rule_flag}) &  &PFRULE_NOSYNC) || ( ($st->{proto}) ==  &IPPROTO_PFSYNC))  ($st->{sync_flags}) |=  &PFSTATE_NOSYNC;  &else  &if (! ($st->{sync_flags}))  &pfsync_pack_state( &PFSYNC_ACT_INS, ($st),  &PFSYNC_FLAG_COMPRESS);  ($st->{sync_flags}) &= ~ &PFSTATE_FROMSYNC; }  &while (0));
	}' unless defined(&pfsync_insert_state);
	eval 'sub pfsync_update_state {
	    my($st) = @_;
    	    eval q( &do {  &if (! ($st->{sync_flags}))  &pfsync_pack_state( &PFSYNC_ACT_UPD, ($st),  &PFSYNC_FLAG_COMPRESS);  ($st->{sync_flags}) &= ~ &PFSTATE_FROMSYNC; }  &while (0));
	}' unless defined(&pfsync_update_state);
	eval 'sub pfsync_delete_state {
	    my($st) = @_;
    	    eval q( &do {  &if (! ($st->{sync_flags}))  &pfsync_pack_state( &PFSYNC_ACT_DEL, ($st),  &PFSYNC_FLAG_COMPRESS); }  &while (0));
	}' unless defined(&pfsync_delete_state);
    }
}
1;
