Class: RadixNode

Inherits:
Object
  • Object
show all
Defined in:
ext/radix.c

Instance Method Summary collapse

Instance Method Details

#familyObject



798
799
800
801
802
803
804
805
806
807
808
809
810
811
# File 'ext/radix.c', line 798

static VALUE
rb_rn_af_get(VALUE self)
{
	struct radixnode *rn;
	int family;

	Data_Get_Struct(self, struct radixnode, rn);

	if (rn->prefix.family == AF_INET)
		family = 4;
	else
		family = 6;
	return INT2FIX(family);
}

#msgObject



749
750
751
752
753
754
755
756
757
758
759
760
# File 'ext/radix.c', line 749

static VALUE
rb_rn_msg_get(VALUE self)
{
	struct radixnode *rn;

	Data_Get_Struct(self, struct radixnode, rn);

	if (rn == NULL)
		return Qnil;

	return rn->msg;
}

#networkObject



775
776
777
778
779
780
781
782
783
784
785
786
# File 'ext/radix.c', line 775

static VALUE
rb_rn_network_get(VALUE self)
{
	struct radixnode *rn;
	char prefix[256];

	Data_Get_Struct(self, struct radixnode, rn);

	prefix_addr_ntop(&rn->prefix, prefix, sizeof(prefix));

	return rb_tainted_str_new(prefix, strlen(prefix));
}

#prefixObject



762
763
764
765
766
767
768
769
770
771
772
773
# File 'ext/radix.c', line 762

static VALUE
rb_rn_prefix_get(VALUE self)
{
	struct radixnode *rn;
	char prefix[256];

	Data_Get_Struct(self, struct radixnode, rn);

	prefix_ntop(&rn->prefix, prefix, sizeof(prefix));

	return rb_tainted_str_new(prefix, strlen(prefix));
}

#prefixlenObject



788
789
790
791
792
793
794
795
796
# File 'ext/radix.c', line 788

static VALUE
rb_rn_prefixlen_get(VALUE self)
{
	struct radixnode *rn;

	Data_Get_Struct(self, struct radixnode, rn);

	return INT2FIX(rn->prefix.bitlen);
}