Sha256: 470f8e0786417182c8810ba494f2234714cd53faf6b52c3c46135dcadd6b2821
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
/* * rubyipq v0.1.0 * Ruby bindings for Netfilter's libipq. * * Copyright (c) 2005 Leonardo Eloy * Author: Leonardo Eloy <l.eloy@terra.com.br/leonardo.eloy@gmail.com> * Project Homepage: http://rubyipq.rubyforge.org * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "rubyipq.h" /* UDP header methods */ VALUE udpheader_new(VALUE class) { last_udp_h = get_last_udp_h(); return class; } VALUE udpheader_init(VALUE class) { return class; } VALUE udpheader_source(VALUE class) { return INT2NUM(ntohs((__u16)get_last_udp_h()->source)); } VALUE udpheader_dest(VALUE class) { return INT2NUM(ntohs((__u16)get_last_udp_h()->dest)); } VALUE udpheader_len(VALUE class) { return INT2NUM(get_last_udp_h()->len); } VALUE udpheader_check(VALUE class) { return INT2NUM(get_last_udp_h()->check); } VALUE udpheader_get_data(VALUE class) { /* UDP header has always 8 bytes in size */ if ((unsigned int)ntohs(get_last_ip_h()->tot_len) - (get_last_ip_h()->ihl<<2) + 8) { char *str; str = (get_last_packet_msg()->payload + (get_last_ip_h()->ihl<<2) + 8); return rb_str_new2(str); } return Qnil; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyipq-0.1.0-i686-linux | rubyipq_udpheader.c |