sctp-socket 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.gitignore +1 -0
- data/CHANGES.md +5 -0
- data/Gemfile +2 -10
- data/README.md +11 -2
- data/Rakefile +10 -9
- data/ext/sctp/extconf.rb +2 -0
- data/ext/sctp/socket.c +269 -6
- data/sctp-socket.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 319cf8cad773727889aed0c51508d4febfa4e145f9572ef2cdc265bdfc4c6ef2
|
4
|
+
data.tar.gz: aa085297b675c4f8a1468d689868a25ff6e9b9f5c954324801146b3878bdb150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a26f8069a0034447ceadd4bb5e59af079da161e4ed0d2620de9df1809e072284fa2fc7aea0799f8f1d17f2da74de744ebc4fec399f21f93e0afa713092b5e0ca
|
7
|
+
data.tar.gz: 5267896027a79534c91c52396528654a9f046437ccf437be392d1609fbee72980cfd18116db8e85453048976a990084321089d6159822a5453d4ba155163581f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/CHANGES.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.0.5 - 15-Dec-2021
|
2
|
+
* Add handling for Linux platforms that don't support the sctp_sendv function
|
3
|
+
and/or the SCTP_SEND_FAILED_EVENT notification.
|
4
|
+
* Some minor updates to Rakefile and Gemfile.
|
5
|
+
|
1
6
|
## 0.0.4 - 3-Dec-2020
|
2
7
|
* Added the send method. Use this when you already have a connection.
|
3
8
|
* Fixed a flags bug in the sendmsg method.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -12,7 +12,7 @@ On some systems, such as RHEL8, you may need to enable the sctp module.
|
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
`gem install sctp-socket`
|
16
16
|
|
17
17
|
## About SCTP
|
18
18
|
|
@@ -30,7 +30,7 @@ is applied to correct loss or corruption of data.
|
|
30
30
|
|
31
31
|
## Synopsis
|
32
32
|
|
33
|
-
```
|
33
|
+
```ruby
|
34
34
|
# sample_server.rb
|
35
35
|
require 'sctp/socket'
|
36
36
|
|
@@ -62,10 +62,19 @@ end
|
|
62
62
|
Currently this has only been developed and tested on Linux. Other platforms
|
63
63
|
will probably only be supported via community contributions.
|
64
64
|
|
65
|
+
On Ubuntu 20 and possibly other Linux variants, the sendv method is not
|
66
|
+
available. Use the sendmsg method instead.
|
67
|
+
|
65
68
|
Please report any issues on the github project page.
|
66
69
|
|
67
70
|
https://github.com/djberg96/sctp-socket
|
68
71
|
|
72
|
+
## More Information on SCTP
|
73
|
+
|
74
|
+
* https://www.linuxjournal.com/article/9748
|
75
|
+
* https://www.linuxjournal.com/article/9749
|
76
|
+
* https://www.linuxjournal.com/article/9784
|
77
|
+
|
69
78
|
## License
|
70
79
|
|
71
80
|
Apache-2.0
|
data/Rakefile
CHANGED
@@ -6,20 +6,21 @@ require 'rake/extensiontask'
|
|
6
6
|
include RbConfig
|
7
7
|
|
8
8
|
CLEAN.include(
|
9
|
-
'**/*.gem',
|
10
|
-
'**/*.rbc',
|
11
|
-
'**/*.o',
|
12
|
-
'**/*.log',
|
13
|
-
'**/Makefile',
|
14
|
-
'**/conftest.dSYM',
|
15
|
-
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
9
|
+
'**/*.gem', # Gem files
|
10
|
+
'**/*.rbc', # Rubinius
|
11
|
+
'**/*.o', # C object file
|
12
|
+
'**/*.log', # Ruby extension build log
|
13
|
+
'**/Makefile', # C Makefile
|
14
|
+
'**/conftest.dSYM', # OS X build directory
|
15
|
+
"**/*.#{CONFIG['DLEXT']}", # C shared object
|
16
|
+
'tmp' # Rake compiler
|
16
17
|
)
|
17
18
|
|
18
19
|
namespace :gem do
|
19
20
|
desc "Create the sys-uname gem"
|
20
21
|
task :create => [:clean] do
|
21
22
|
require 'rubygems/package'
|
22
|
-
spec =
|
23
|
+
spec = Gem::Specification.load('sctp-socket.gemspec')
|
23
24
|
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
24
25
|
Gem::Package.build(spec)
|
25
26
|
end
|
@@ -39,4 +40,4 @@ end
|
|
39
40
|
RSpec::Core::RakeTask.new
|
40
41
|
|
41
42
|
task :spec => :compile
|
42
|
-
task :default => :spec
|
43
|
+
task :default => [:clean, :spec]
|
data/ext/sctp/extconf.rb
CHANGED
data/ext/sctp/socket.c
CHANGED
@@ -17,11 +17,44 @@ VALUE v_adaptation_event_struct;
|
|
17
17
|
VALUE v_partial_delivery_event_struct;
|
18
18
|
VALUE v_auth_event_struct;
|
19
19
|
VALUE v_sockaddr_in_struct;
|
20
|
-
|
20
|
+
VALUE v_sctp_status_struct;
|
21
|
+
VALUE v_sctp_rtoinfo_struct;
|
22
|
+
VALUE v_sctp_associnfo_struct;
|
23
|
+
VALUE v_sctp_default_send_params_struct;
|
24
|
+
|
25
|
+
#if !defined(IOV_MAX)
|
26
|
+
#if defined(_SC_IOV_MAX)
|
27
|
+
#define IOV_MAX (sysconf(_SC_IOV_MAX))
|
28
|
+
#else
|
29
|
+
// Assume infinity, or let the syscall return with error
|
30
|
+
#define IOV_MAX INT_MAX
|
31
|
+
#endif
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#define ARY2IOVEC(iov,ary) \
|
35
|
+
do { \
|
36
|
+
VALUE *cur; \
|
37
|
+
struct iovec *tmp; \
|
38
|
+
long n; \
|
39
|
+
cur = RARRAY_PTR(ary); \
|
40
|
+
n = RARRAY_LEN(ary); \
|
41
|
+
iov = tmp = alloca(sizeof(struct iovec) * n); \
|
42
|
+
for (; --n >= 0; tmp++, cur++) { \
|
43
|
+
if (TYPE(*cur) != T_STRING) \
|
44
|
+
rb_raise(rb_eArgError, "must be an array of strings"); \
|
45
|
+
tmp->iov_base = RSTRING_PTR(*cur); \
|
46
|
+
tmp->iov_len = RSTRING_LEN(*cur); \
|
47
|
+
} \
|
48
|
+
} while (0)
|
49
|
+
|
50
|
+
// TODO: Yes, I know I need to update the signature.
|
21
51
|
VALUE convert_sockaddr_in_to_struct(struct sockaddr_in* addr){
|
22
|
-
char ipbuf[
|
52
|
+
char ipbuf[INET6_ADDRSTRLEN];
|
23
53
|
|
24
|
-
|
54
|
+
if(addr->sin_family == AF_INET6)
|
55
|
+
inet_ntop(addr->sin_family, &(((struct sockaddr_in6 *)addr)->sin6_addr), ipbuf, sizeof(ipbuf));
|
56
|
+
else
|
57
|
+
inet_ntop(addr->sin_family, &(((struct sockaddr_in *)addr)->sin_addr), ipbuf, sizeof(ipbuf));
|
25
58
|
|
26
59
|
return rb_struct_new(v_sockaddr_in_struct,
|
27
60
|
INT2NUM(addr->sin_family),
|
@@ -316,6 +349,51 @@ static VALUE rsctp_getlocalnames(VALUE self){
|
|
316
349
|
return v_array;
|
317
350
|
}
|
318
351
|
|
352
|
+
#ifdef HAVE_SCTP_SENDV
|
353
|
+
static VALUE rsctp_sendv(VALUE self, VALUE v_messages){
|
354
|
+
struct iovec* iov;
|
355
|
+
struct sockaddr* addrs[8];
|
356
|
+
struct sctp_sndinfo info;
|
357
|
+
int sock_fd, num_bytes, size;
|
358
|
+
|
359
|
+
Check_Type(v_messages, T_ARRAY);
|
360
|
+
bzero(&addrs, sizeof(addrs));
|
361
|
+
|
362
|
+
sock_fd = NUM2INT(rb_iv_get(self, "@sock_fd"));
|
363
|
+
|
364
|
+
Check_Type(v_messages, T_ARRAY);
|
365
|
+
size = RARRAY_LEN(v_messages);
|
366
|
+
|
367
|
+
if(!size)
|
368
|
+
rb_raise(rb_eArgError, "Must contain at least one message");
|
369
|
+
|
370
|
+
if(size > IOV_MAX)
|
371
|
+
rb_raise(rb_eArgError, "Array size is greater than IOV_MAX");
|
372
|
+
|
373
|
+
ARY2IOVEC(iov, v_messages);
|
374
|
+
|
375
|
+
info.snd_flags = SCTP_UNORDERED;
|
376
|
+
info.snd_assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
|
377
|
+
|
378
|
+
num_bytes = sctp_sendv(
|
379
|
+
sock_fd,
|
380
|
+
iov,
|
381
|
+
size,
|
382
|
+
NULL,
|
383
|
+
0,
|
384
|
+
&info,
|
385
|
+
sizeof(info),
|
386
|
+
SCTP_SENDV_SNDINFO,
|
387
|
+
0
|
388
|
+
);
|
389
|
+
|
390
|
+
if(num_bytes < 0)
|
391
|
+
rb_raise(rb_eSystemCallError, "sctp_sendv: %s", strerror(errno));
|
392
|
+
|
393
|
+
return INT2NUM(num_bytes);
|
394
|
+
}
|
395
|
+
#endif
|
396
|
+
|
319
397
|
/*
|
320
398
|
* Send a message on an already-connected socket to a specific association.
|
321
399
|
*
|
@@ -678,6 +756,7 @@ static VALUE rsctp_recvmsg(int argc, VALUE* argv, VALUE self){
|
|
678
756
|
rb_ary_new4(snp->sn_remote_error.sre_length, v_temp)
|
679
757
|
);
|
680
758
|
break;
|
759
|
+
#ifdef SCTP_SEND_FAILED_EVENT
|
681
760
|
case SCTP_SEND_FAILED_EVENT:
|
682
761
|
v_temp = ALLOCA_N(VALUE, snp->sn_send_failed_event.ssf_length);
|
683
762
|
|
@@ -700,6 +779,24 @@ static VALUE rsctp_recvmsg(int argc, VALUE* argv, VALUE self){
|
|
700
779
|
rb_ary_new4(snp->sn_send_failed_event.ssf_length, v_temp)
|
701
780
|
);
|
702
781
|
break;
|
782
|
+
#else
|
783
|
+
case SCTP_SEND_FAILED:
|
784
|
+
v_temp = ALLOCA_N(VALUE, snp->sn_send_failed.ssf_length);
|
785
|
+
|
786
|
+
for(i = 0; i < snp->sn_send_failed.ssf_length; i++){
|
787
|
+
v_temp[i] = UINT2NUM(snp->sn_send_failed.ssf_data[i]);
|
788
|
+
}
|
789
|
+
|
790
|
+
v_notification = rb_struct_new(v_send_failed_event_struct,
|
791
|
+
UINT2NUM(snp->sn_send_failed.ssf_type),
|
792
|
+
UINT2NUM(snp->sn_send_failed.ssf_length),
|
793
|
+
UINT2NUM(snp->sn_send_failed.ssf_error),
|
794
|
+
Qnil,
|
795
|
+
UINT2NUM(snp->sn_send_failed.ssf_assoc_id),
|
796
|
+
rb_ary_new4(snp->sn_send_failed.ssf_length, v_temp)
|
797
|
+
);
|
798
|
+
break;
|
799
|
+
#endif
|
703
800
|
case SCTP_SHUTDOWN_EVENT:
|
704
801
|
v_notification = rb_struct_new(v_shutdown_event_struct,
|
705
802
|
UINT2NUM(snp->sn_shutdown_event.sse_type),
|
@@ -860,9 +957,12 @@ static VALUE rsctp_subscribe(VALUE self, VALUE v_options){
|
|
860
957
|
if(RTEST(rb_hash_aref2(v_options, "address")))
|
861
958
|
events.sctp_address_event = 1;
|
862
959
|
|
863
|
-
// Use the new version
|
864
960
|
if(RTEST(rb_hash_aref2(v_options, "send_failure")))
|
961
|
+
#ifdef HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_SEND_FAILURE_EVENT
|
962
|
+
events.sctp_send_failure_event = 1;
|
963
|
+
#else
|
865
964
|
events.sctp_send_failure_event_event = 1;
|
965
|
+
#endif
|
866
966
|
|
867
967
|
if(RTEST(rb_hash_aref2(v_options, "peer_error")))
|
868
968
|
events.sctp_peer_error_event = 1;
|
@@ -942,6 +1042,61 @@ static VALUE rsctp_peeloff(VALUE self, VALUE v_assoc_id){
|
|
942
1042
|
return self;
|
943
1043
|
}
|
944
1044
|
|
1045
|
+
static VALUE rsctp_get_default_send_params(VALUE self){
|
1046
|
+
int sock_fd;
|
1047
|
+
socklen_t size;
|
1048
|
+
sctp_assoc_t assoc_id;
|
1049
|
+
struct sctp_sndrcvinfo sndrcv;
|
1050
|
+
|
1051
|
+
bzero(&sndrcv, sizeof(sndrcv));
|
1052
|
+
|
1053
|
+
sock_fd = NUM2INT(rb_iv_get(self, "@sock_fd"));
|
1054
|
+
assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
|
1055
|
+
size = sizeof(struct sctp_sndrcvinfo);
|
1056
|
+
|
1057
|
+
if(sctp_opt_info(sock_fd, assoc_id, SCTP_DEFAULT_SEND_PARAM, (void*)&sndrcv, &size) < 0)
|
1058
|
+
rb_raise(rb_eSystemCallError, "sctp_opt_info: %s", strerror(errno));
|
1059
|
+
|
1060
|
+
return rb_struct_new(
|
1061
|
+
v_sctp_default_send_params_struct,
|
1062
|
+
INT2NUM(sndrcv.sinfo_stream),
|
1063
|
+
INT2NUM(sndrcv.sinfo_ssn),
|
1064
|
+
INT2NUM(sndrcv.sinfo_flags),
|
1065
|
+
INT2NUM(sndrcv.sinfo_ppid),
|
1066
|
+
INT2NUM(sndrcv.sinfo_context),
|
1067
|
+
INT2NUM(sndrcv.sinfo_timetolive),
|
1068
|
+
INT2NUM(sndrcv.sinfo_tsn),
|
1069
|
+
INT2NUM(sndrcv.sinfo_cumtsn),
|
1070
|
+
INT2NUM(sndrcv.sinfo_assoc_id)
|
1071
|
+
);
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
static VALUE rsctp_get_association_info(VALUE self){
|
1075
|
+
int sock_fd;
|
1076
|
+
socklen_t size;
|
1077
|
+
sctp_assoc_t assoc_id;
|
1078
|
+
struct sctp_assocparams assoc;
|
1079
|
+
|
1080
|
+
bzero(&assoc, sizeof(assoc));
|
1081
|
+
|
1082
|
+
sock_fd = NUM2INT(rb_iv_get(self, "@sock_fd"));
|
1083
|
+
assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
|
1084
|
+
size = sizeof(struct sctp_assocparams);
|
1085
|
+
|
1086
|
+
if(sctp_opt_info(sock_fd, assoc_id, SCTP_ASSOCINFO, (void*)&assoc, &size) < 0)
|
1087
|
+
rb_raise(rb_eSystemCallError, "sctp_opt_info: %s", strerror(errno));
|
1088
|
+
|
1089
|
+
return rb_struct_new(
|
1090
|
+
v_sctp_associnfo_struct,
|
1091
|
+
INT2NUM(assoc.sasoc_assoc_id),
|
1092
|
+
INT2NUM(assoc.sasoc_asocmaxrxt),
|
1093
|
+
INT2NUM(assoc.sasoc_number_peer_destinations),
|
1094
|
+
INT2NUM(assoc.sasoc_peer_rwnd),
|
1095
|
+
INT2NUM(assoc.sasoc_local_rwnd),
|
1096
|
+
INT2NUM(assoc.sasoc_cookie_life)
|
1097
|
+
);
|
1098
|
+
}
|
1099
|
+
|
945
1100
|
static VALUE rsctp_shutdown(int argc, VALUE* argv, VALUE self){
|
946
1101
|
int how, sock_fd;
|
947
1102
|
VALUE v_how;
|
@@ -964,6 +1119,73 @@ static VALUE rsctp_shutdown(int argc, VALUE* argv, VALUE self){
|
|
964
1119
|
return self;
|
965
1120
|
}
|
966
1121
|
|
1122
|
+
static VALUE rsctp_get_retransmission_info(VALUE self){
|
1123
|
+
int sock_fd;
|
1124
|
+
socklen_t size;
|
1125
|
+
sctp_assoc_t assoc_id;
|
1126
|
+
struct sctp_rtoinfo rto;
|
1127
|
+
|
1128
|
+
bzero(&rto, sizeof(rto));
|
1129
|
+
|
1130
|
+
sock_fd = NUM2INT(rb_iv_get(self, "@sock_fd"));
|
1131
|
+
assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
|
1132
|
+
size = sizeof(struct sctp_rtoinfo);
|
1133
|
+
|
1134
|
+
if(sctp_opt_info(sock_fd, assoc_id, SCTP_RTOINFO, (void*)&rto, &size) < 0)
|
1135
|
+
rb_raise(rb_eSystemCallError, "sctp_opt_info: %s", strerror(errno));
|
1136
|
+
|
1137
|
+
return rb_struct_new(
|
1138
|
+
v_sctp_rtoinfo_struct,
|
1139
|
+
INT2NUM(rto.srto_assoc_id),
|
1140
|
+
INT2NUM(rto.srto_initial),
|
1141
|
+
INT2NUM(rto.srto_max),
|
1142
|
+
INT2NUM(rto.srto_min)
|
1143
|
+
);
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
static VALUE rsctp_get_status(VALUE self){
|
1147
|
+
int sock_fd;
|
1148
|
+
socklen_t size;
|
1149
|
+
sctp_assoc_t assoc_id;
|
1150
|
+
struct sctp_status status;
|
1151
|
+
struct sctp_paddrinfo* spinfo;
|
1152
|
+
char tmpname[INET_ADDRSTRLEN];
|
1153
|
+
|
1154
|
+
bzero(&status, sizeof(status));
|
1155
|
+
|
1156
|
+
sock_fd = NUM2INT(rb_iv_get(self, "@sock_fd"));
|
1157
|
+
assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
|
1158
|
+
size = sizeof(struct sctp_status);
|
1159
|
+
|
1160
|
+
if(sctp_opt_info(sock_fd, assoc_id, SCTP_STATUS, (void*)&status, &size) < 0)
|
1161
|
+
rb_raise(rb_eSystemCallError, "sctp_opt_info: %s", strerror(errno));
|
1162
|
+
|
1163
|
+
spinfo = &status.sstat_primary;
|
1164
|
+
|
1165
|
+
if (spinfo->spinfo_address.ss_family == AF_INET6) {
|
1166
|
+
struct sockaddr_in6 *sin6;
|
1167
|
+
sin6 = (struct sockaddr_in6 *)&spinfo->spinfo_address;
|
1168
|
+
inet_ntop(AF_INET6, &sin6->sin6_addr, tmpname, sizeof (tmpname));
|
1169
|
+
}
|
1170
|
+
else {
|
1171
|
+
struct sockaddr_in *sin;
|
1172
|
+
sin = (struct sockaddr_in *)&spinfo->spinfo_address;
|
1173
|
+
inet_ntop(AF_INET, &sin->sin_addr, tmpname, sizeof (tmpname));
|
1174
|
+
}
|
1175
|
+
|
1176
|
+
return rb_struct_new(v_sctp_status_struct,
|
1177
|
+
INT2NUM(status.sstat_assoc_id),
|
1178
|
+
INT2NUM(status.sstat_state),
|
1179
|
+
INT2NUM(status.sstat_rwnd),
|
1180
|
+
INT2NUM(status.sstat_unackdata),
|
1181
|
+
INT2NUM(status.sstat_penddata),
|
1182
|
+
INT2NUM(status.sstat_instrms),
|
1183
|
+
INT2NUM(status.sstat_outstrms),
|
1184
|
+
INT2NUM(status.sstat_fragmentation_point),
|
1185
|
+
rb_str_new2(tmpname)
|
1186
|
+
);
|
1187
|
+
}
|
1188
|
+
|
967
1189
|
void Init_socket(){
|
968
1190
|
mSCTP = rb_define_module("SCTP");
|
969
1191
|
cSocket = rb_define_class_under(mSCTP, "Socket", rb_cObject);
|
@@ -1016,6 +1238,26 @@ void Init_socket(){
|
|
1016
1238
|
"SockAddrIn", "family", "port", "address", NULL
|
1017
1239
|
);
|
1018
1240
|
|
1241
|
+
v_sctp_status_struct = rb_struct_define(
|
1242
|
+
"Status", "association_id", "state", "receive_window", "unacknowledged_data",
|
1243
|
+
"pending_data", "inbound_streams", "outbound_streams", "fragmentation_point", "primary", NULL
|
1244
|
+
);
|
1245
|
+
|
1246
|
+
v_sctp_rtoinfo_struct = rb_struct_define(
|
1247
|
+
"RetransmissionInfo", "association_id", "initial", "max", "min", NULL
|
1248
|
+
);
|
1249
|
+
|
1250
|
+
v_sctp_associnfo_struct = rb_struct_define(
|
1251
|
+
"AssociationInfo", "association_id", "max_retransmission_count",
|
1252
|
+
"number_peer_destinations", "peer_receive_window", "local_receive_window",
|
1253
|
+
"cookie_life", NULL
|
1254
|
+
);
|
1255
|
+
|
1256
|
+
v_sctp_default_send_params_struct = rb_struct_define(
|
1257
|
+
"DefaultSendParams", "stream", "ssn", "flags", "ppid", "context",
|
1258
|
+
"ttl", "tsn", "cumtsn", "association_id", NULL
|
1259
|
+
);
|
1260
|
+
|
1019
1261
|
rb_define_method(cSocket, "initialize", rsctp_init, -1);
|
1020
1262
|
|
1021
1263
|
rb_define_method(cSocket, "bind", rsctp_bind, -1);
|
@@ -1023,10 +1265,19 @@ void Init_socket(){
|
|
1023
1265
|
rb_define_method(cSocket, "connect", rsctp_connect, -1);
|
1024
1266
|
rb_define_method(cSocket, "getpeernames", rsctp_getpeernames, 0);
|
1025
1267
|
rb_define_method(cSocket, "getlocalnames", rsctp_getlocalnames, 0);
|
1268
|
+
rb_define_method(cSocket, "get_status", rsctp_get_status, 0);
|
1269
|
+
rb_define_method(cSocket, "get_default_send_params", rsctp_get_default_send_params, 0);
|
1270
|
+
rb_define_method(cSocket, "get_retransmission_info", rsctp_get_retransmission_info, 0);
|
1271
|
+
rb_define_method(cSocket, "get_association_info", rsctp_get_association_info, 0);
|
1026
1272
|
rb_define_method(cSocket, "listen", rsctp_listen, -1);
|
1027
1273
|
rb_define_method(cSocket, "peeloff!", rsctp_peeloff, 1);
|
1028
1274
|
rb_define_method(cSocket, "recvmsg", rsctp_recvmsg, -1);
|
1029
1275
|
rb_define_method(cSocket, "send", rsctp_send, 1);
|
1276
|
+
|
1277
|
+
#ifdef HAVE_SCTP_SENDV
|
1278
|
+
rb_define_method(cSocket, "sendv", rsctp_sendv, 1);
|
1279
|
+
#endif
|
1280
|
+
|
1030
1281
|
rb_define_method(cSocket, "sendmsg", rsctp_sendmsg, 1);
|
1031
1282
|
rb_define_method(cSocket, "set_initmsg", rsctp_set_initmsg, 1);
|
1032
1283
|
rb_define_method(cSocket, "shutdown", rsctp_shutdown, -1);
|
@@ -1038,8 +1289,8 @@ void Init_socket(){
|
|
1038
1289
|
rb_define_attr(cSocket, "association_id", 1, 1);
|
1039
1290
|
rb_define_attr(cSocket, "port", 1, 1);
|
1040
1291
|
|
1041
|
-
/* 0.0.
|
1042
|
-
rb_define_const(cSocket, "VERSION", rb_str_new2("0.0.
|
1292
|
+
/* 0.0.5: The version of this library */
|
1293
|
+
rb_define_const(cSocket, "VERSION", rb_str_new2("0.0.5"));
|
1043
1294
|
|
1044
1295
|
/* send flags */
|
1045
1296
|
|
@@ -1059,4 +1310,16 @@ void Init_socket(){
|
|
1059
1310
|
rb_define_const(cSocket, "SCTP_SENDALL", INT2NUM(SCTP_SENDALL));
|
1060
1311
|
|
1061
1312
|
rb_define_const(cSocket, "MSG_NOTIFICATION", INT2NUM(MSG_NOTIFICATION));
|
1313
|
+
|
1314
|
+
// ASSOCIATION STATES //
|
1315
|
+
|
1316
|
+
rb_define_const(cSocket, "SCTP_EMPTY", INT2NUM(SCTP_EMPTY));
|
1317
|
+
rb_define_const(cSocket, "SCTP_CLOSED", INT2NUM(SCTP_CLOSED));
|
1318
|
+
rb_define_const(cSocket, "SCTP_COOKIE_WAIT", INT2NUM(SCTP_COOKIE_WAIT));
|
1319
|
+
rb_define_const(cSocket, "SCTP_COOKIE_ECHOED", INT2NUM(SCTP_COOKIE_ECHOED));
|
1320
|
+
rb_define_const(cSocket, "SCTP_ESTABLISHED", INT2NUM(SCTP_ESTABLISHED));
|
1321
|
+
rb_define_const(cSocket, "SCTP_SHUTDOWN_PENDING", INT2NUM(SCTP_SHUTDOWN_PENDING));
|
1322
|
+
rb_define_const(cSocket, "SCTP_SHUTDOWN_SENT", INT2NUM(SCTP_SHUTDOWN_SENT));
|
1323
|
+
rb_define_const(cSocket, "SCTP_SHUTDOWN_RECEIVED", INT2NUM(SCTP_SHUTDOWN_RECEIVED));
|
1324
|
+
rb_define_const(cSocket, "SCTP_SHUTDOWN_ACK_SENT", INT2NUM(SCTP_SHUTDOWN_ACK_SENT));
|
1062
1325
|
}
|
data/sctp-socket.gemspec
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sctp-socket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Berger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-12-15 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: bundler
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.2.25
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Ruby bindings for SCTP sockets
|
metadata.gz.sig
CHANGED
Binary file
|