Sha256: bb503521a349287ca02351d192955b4b435d8fafda5e26e731529c4890ad6482

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 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"

/* IPHeader methods */
VALUE ipheader_new(VALUE class) {
        last_ip_h = get_last_ip_h();

        return class;
}

VALUE ipheader_init(VALUE class) {
        return class;
}

VALUE ipheader_tos(VALUE class) {
        return INT2NUM(get_last_ip_h()->tos);
}

VALUE ipheader_tot_len(VALUE class) {
        return INT2NUM(get_last_ip_h()->tot_len);
}

VALUE ipheader_id(VALUE class) {
        return INT2NUM(get_last_ip_h()->id);
}

VALUE ipheader_frag_off(VALUE class) {
        return INT2NUM(get_last_ip_h()->frag_off);
}

VALUE ipheader_ttl(VALUE class) {
        return INT2NUM(get_last_ip_h()->ttl);
}

VALUE ipheader_protocol(VALUE class) {
        return INT2NUM(get_last_ip_h()->protocol);
}

VALUE ipheader_check(VALUE class) {
        return INT2NUM(get_last_ip_h()->check);
}

VALUE ipheader_saddr(VALUE class) {
        return rb_str_new2(__u32_to_str((__u32)get_last_ip_h()->saddr));
}

VALUE ipheader_daddr(VALUE class) {
        return rb_str_new2(__u32_to_str((__u32)get_last_ip_h()->daddr));
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyipq-0.1.0-i686-linux rubyipq_ipheader.c