From a9f3fe3d85d7052c1423e25acf40dbed36ff5c6c Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Sun, 27 Apr 2008 07:54:56 +0000 Subject: Update PostgreSQL schema to add the insert procedure for conntrack connections. Signed-off-by: Pierre Chifflier --- doc/pgsql-ulogd2.sql | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/pgsql-ulogd2.sql b/doc/pgsql-ulogd2.sql index cfef267..a5d686d 100644 --- a/doc/pgsql-ulogd2.sql +++ b/doc/pgsql-ulogd2.sql @@ -228,10 +228,10 @@ CREATE TABLE ulog2_ct ( icmp_code smallint default NULL, icmp_type smallint default NULL, ct_mark bigint default 0, - flow_start_sec integer default 0, - flow_start_usec integer default 0, - flow_end_sec integer default 0, - flow_end_usec integer default 0, + flow_start_sec bigint default 0, + flow_start_usec bigint default 0, + flow_end_sec bigint default 0, + flow_end_usec bigint default 0, state smallint default 0 ) WITH (OIDS=FALSE); @@ -518,6 +518,46 @@ $$ LANGUAGE plpgsql SECURITY INVOKER; +CREATE OR REPLACE FUNCTION INSERT_CT( + IN _oob_family integer, + IN _orig_ip_saddr inet, + IN _orig_ip_daddr inet, + IN _orig_ip_protocol integer, + IN _orig_l4_sport integer, + IN _orig_l4_dport integer, + IN _orig_bytes bigint, + IN _orig_packets bigint, + IN _reply_ip_saddr inet, + IN _reply_ip_daddr inet, + IN _reply_ip_protocol integer, + IN _reply_l4_sport integer, + IN _reply_l4_dport integer, + IN _reply_bytes bigint, + IN _reply_packets bigint, + IN _icmp_code integer, + IN _icmp_type integer, + IN _ct_mark bigint, + IN _flow_start_sec bigint, + IN _flow_start_usec bigint, + IN _flow_end_sec bigint, + IN _flow_end_usec bigint, + IN _state smallint + ) +RETURNS bigint AS $$ + INSERT INTO ulog2_ct (oob_family, orig_ip_saddr_str, orig_ip_daddr_str, orig_ip_protocol, + orig_l4_sport, orig_l4_dport, orig_bytes, orig_packets, + reply_ip_saddr_str, reply_ip_daddr_str, reply_ip_protocol, + reply_l4_sport, reply_l4_dport, reply_bytes, reply_packets, + icmp_code, icmp_type, ct_mark, + flow_start_sec, flow_start_usec, + flow_end_sec, flow_end_usec, state) + VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23); + SELECT currval('ulog2_ct__ct_id_seq'); +$$ LANGUAGE SQL SECURITY INVOKER; + + + + CREATE OR REPLACE FUNCTION DELETE_PACKET( IN _packet_id bigint ) -- cgit v1.2.3