sctp-socket 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ad81d72b62e06897cdc0704d1ea3213392697884787d698bab4985c0e7c822e
4
- data.tar.gz: 975927d8093ff35fe599a51b0d94fd0402cb15de8225dd0143e2598eb35c6ff1
3
+ metadata.gz: 89d20d26ad8e90c5673d4d126da8daa8f69d907a54ba0ddc9caf529ef5929c6e
4
+ data.tar.gz: 886d28171c2e7242a7875b7a998e7073a9bec469da7da5b9205859a4e2d3e257
5
5
  SHA512:
6
- metadata.gz: 8a46199d3d957907bbd3b95b321887018944c964ce12f1650125339445811693b6b9ac08ad894901d94842145ad699114f48c66b6f7dda95a0b859a46625006f
7
- data.tar.gz: 54f42c50b8d63dc1fbd30497064bf605f0fc8e83bd61e27badb10cad9319fe84fe8dbb14bd40455b5d86709537072f99be17dab57a7cb1aa6662238f54e10f08
6
+ metadata.gz: ee23fbff8da2e3efa66f87f583ba1f631d39957a6f74bff530d1b71ae1a15ab773ecb6653f34d8d5e17e034a15f6a736c90a16f3c8f3ed636734ab674dee54ca
7
+ data.tar.gz: 68ff54d9088bfe723f0726c3bcc41c102aab7c3f631f1156f64651bd078ffa1a852b247505a4babf36cb37c61aa11726587db407ad34171c974b6afca96283a8
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.2 - 10-Jan-2025
2
+ * Added support for BSD.
3
+
1
4
  ## 0.1.1 - 1-Jan-2025
2
5
  * Added the set_shared_key method.
3
6
  * Added the get_active_shared_key and set_active_shared_key methods.
data/README.md CHANGED
@@ -63,8 +63,8 @@ end
63
63
 
64
64
  ## Known Issues
65
65
 
66
- Currently this has only been developed and tested on Linux. Other platforms
67
- will probably only be supported via community contributions.
66
+ Currently this has only been developed and tested on Linux and BSD. Other
67
+ platforms will probably only be supported via community contributions.
68
68
 
69
69
  The sendv and recvv methods may not be available. Use the sendmsg and recvmsg
70
70
  methods instead.
@@ -92,7 +92,7 @@ Apache-2.0
92
92
 
93
93
  ## Copyright
94
94
 
95
- (C) 2020-2024, Daniel J. Berger
95
+ (C) 2020-2025, Daniel J. Berger
96
96
  Al Rights Reserved
97
97
 
98
98
  ## Author
data/ext/sctp/extconf.rb CHANGED
@@ -24,8 +24,25 @@ unless have_header('netinet/sctp.h')
24
24
  exit
25
25
  end
26
26
 
27
+ header = 'netinet/sctp.h'
28
+
27
29
  have_library('sctp')
28
- have_func('sctp_sendv', 'netinet/sctp.h')
29
- have_func('sctp_recvv', 'netinet/sctp.h')
30
- have_struct_member('struct sctp_event_subscribe', 'sctp_send_failure_event', 'netinet/sctp.h')
30
+
31
+ have_header('sys/param.h')
32
+
33
+ have_func('sctp_sendv', header)
34
+ have_func('sctp_recvv', header)
35
+
36
+ have_struct_member('struct sctp_event_subscribe', 'sctp_send_failure_event', header)
37
+ have_struct_member('struct sctp_event_subscribe', 'sctp_stream_reset_event', header)
38
+ have_struct_member('struct sctp_event_subscribe', 'sctp_assoc_reset_event', header)
39
+ have_struct_member('struct sctp_event_subscribe', 'sctp_stream_change_event', header)
40
+ have_struct_member('struct sctp_event_subscribe', 'sctp_send_failure_event_event', header)
41
+
42
+ have_struct_member('struct sctp_send_failed_event', 'ssfe_length', header)
43
+
44
+ have_struct_member('union sctp_notification', 'sn_auth_event', header)
45
+
46
+ have_const('SCTP_EMPTY', header)
47
+
31
48
  create_makefile('sctp/socket')
data/ext/sctp/socket.c CHANGED
@@ -4,6 +4,10 @@
4
4
  #include <arpa/inet.h>
5
5
  #include <netinet/sctp.h>
6
6
 
7
+ #ifdef HAVE_SYS_PARAM_H
8
+ #include <sys/param.h>
9
+ #endif
10
+
7
11
  VALUE mSCTP;
8
12
  VALUE cSocket;
9
13
  VALUE v_sndrcv_struct;
@@ -163,6 +167,28 @@ VALUE get_notification_info(char* buffer){
163
167
  break;
164
168
  #ifdef SCTP_SEND_FAILED_EVENT
165
169
  case SCTP_SEND_FAILED_EVENT:
170
+ #ifdef HAVE_STRUCT_SCTP_SEND_FAILED_EVENT_SSFE_LENGTH
171
+ v_temp = ALLOCA_N(VALUE, snp->sn_send_failed_event.ssfe_length);
172
+
173
+ for(i = 0; i < snp->sn_send_failed_event.ssfe_length; i++){
174
+ v_temp[i] = UINT2NUM(snp->sn_send_failed_event.ssfe_data[i]);
175
+ }
176
+
177
+ v_notification = rb_struct_new(v_send_failed_event_struct,
178
+ UINT2NUM(snp->sn_send_failed_event.ssfe_type),
179
+ UINT2NUM(snp->sn_send_failed_event.ssfe_length),
180
+ UINT2NUM(snp->sn_send_failed_event.ssfe_error),
181
+ rb_struct_new(v_sndinfo_struct,
182
+ UINT2NUM(snp->sn_send_failed_event.ssfe_info.snd_sid),
183
+ UINT2NUM(snp->sn_send_failed_event.ssfe_info.snd_flags),
184
+ UINT2NUM(snp->sn_send_failed_event.ssfe_info.snd_ppid),
185
+ UINT2NUM(snp->sn_send_failed_event.ssfe_info.snd_context),
186
+ UINT2NUM(snp->sn_send_failed_event.ssfe_info.snd_assoc_id)
187
+ ),
188
+ UINT2NUM(snp->sn_send_failed_event.ssfe_assoc_id),
189
+ rb_ary_new4(snp->sn_send_failed_event.ssfe_length, v_temp)
190
+ );
191
+ #else
166
192
  v_temp = ALLOCA_N(VALUE, snp->sn_send_failed_event.ssf_length);
167
193
 
168
194
  for(i = 0; i < snp->sn_send_failed_event.ssf_length; i++){
@@ -183,6 +209,7 @@ VALUE get_notification_info(char* buffer){
183
209
  UINT2NUM(snp->sn_send_failed_event.ssf_assoc_id),
184
210
  rb_ary_new4(snp->sn_send_failed_event.ssf_length, v_temp)
185
211
  );
212
+ #endif
186
213
  break;
187
214
  #else
188
215
  case SCTP_SEND_FAILED:
@@ -229,11 +256,19 @@ VALUE get_notification_info(char* buffer){
229
256
  break;
230
257
  case SCTP_AUTHENTICATION_EVENT:
231
258
  v_notification = rb_struct_new(v_auth_event_struct,
259
+ #ifdef HAVE_UNION_SCTP_NOTIFICATION_SN_AUTH_EVENT
260
+ UINT2NUM(snp->sn_auth_event.auth_type),
261
+ UINT2NUM(snp->sn_auth_event.auth_length),
262
+ UINT2NUM(snp->sn_auth_event.auth_keynumber),
263
+ UINT2NUM(snp->sn_auth_event.auth_indication),
264
+ UINT2NUM(snp->sn_auth_event.auth_assoc_id)
265
+ #else
232
266
  UINT2NUM(snp->sn_authkey_event.auth_type),
233
267
  UINT2NUM(snp->sn_authkey_event.auth_length),
234
268
  UINT2NUM(snp->sn_authkey_event.auth_keynumber),
235
269
  UINT2NUM(snp->sn_authkey_event.auth_indication),
236
270
  UINT2NUM(snp->sn_authkey_event.auth_assoc_id)
271
+ #endif
237
272
  );
238
273
  break;
239
274
  case SCTP_SENDER_DRY_EVENT:
@@ -349,7 +384,7 @@ static VALUE rsctp_bindx(int argc, VALUE* argv, VALUE self){
349
384
  if(NIL_P(v_addresses))
350
385
  num_ip = 1;
351
386
  else
352
- num_ip = RARRAY_LEN(v_addresses);
387
+ num_ip = (int)RARRAY_LEN(v_addresses);
353
388
 
354
389
  domain = NUM2INT(rb_iv_get(self, "@domain"));
355
390
  fileno = NUM2INT(rb_iv_get(self, "@fileno"));
@@ -360,12 +395,18 @@ static VALUE rsctp_bindx(int argc, VALUE* argv, VALUE self){
360
395
  addrs[i].sin_family = domain;
361
396
  addrs[i].sin_port = htons(port);
362
397
  addrs[i].sin_addr.s_addr = inet_addr(StringValueCStr(v_address));
398
+ #ifdef BSD
399
+ addrs[i].sin_len = sizeof(struct sockaddr_in);
400
+ #endif
363
401
  }
364
402
  }
365
403
  else{
366
404
  addrs[0].sin_family = domain;
367
405
  addrs[0].sin_port = htons(port);
368
406
  addrs[0].sin_addr.s_addr = htonl(INADDR_ANY);
407
+ #ifdef BSD
408
+ addrs[0].sin_len = sizeof(struct sockaddr_in);
409
+ #endif
369
410
  }
370
411
 
371
412
  if(sctp_bindx(fileno, (struct sockaddr *) addrs, num_ip, flags) != 0)
@@ -427,7 +468,7 @@ static VALUE rsctp_connectx(int argc, VALUE* argv, VALUE self){
427
468
 
428
469
  v_domain = rb_iv_get(self, "@domain");
429
470
 
430
- num_ip = RARRAY_LEN(v_addresses);
471
+ num_ip = (int)RARRAY_LEN(v_addresses);
431
472
  bzero(&addrs, sizeof(addrs));
432
473
 
433
474
  for(i = 0; i < num_ip; i++){
@@ -435,6 +476,9 @@ static VALUE rsctp_connectx(int argc, VALUE* argv, VALUE self){
435
476
  addrs[i].sin_family = NUM2INT(v_domain);
436
477
  addrs[i].sin_port = htons(NUM2INT(v_port));
437
478
  addrs[i].sin_addr.s_addr = inet_addr(StringValueCStr(v_address));
479
+ #ifdef BSD
480
+ addrs[i].sin_len = sizeof(struct sockaddr_in);
481
+ #endif
438
482
  }
439
483
 
440
484
  fileno = NUM2INT(rb_iv_get(self, "@fileno"));
@@ -617,7 +661,8 @@ static VALUE rsctp_sendv(VALUE self, VALUE v_options){
617
661
  struct iovec iov[IOV_MAX];
618
662
  struct sockaddr_in* addrs;
619
663
  struct sctp_sendv_spa spa;
620
- int i, fileno, num_bytes, size, num_ip;
664
+ int i, fileno, size, num_ip;
665
+ ssize_t num_bytes;
621
666
 
622
667
  Check_Type(v_options, T_HASH);
623
668
 
@@ -632,7 +677,7 @@ static VALUE rsctp_sendv(VALUE self, VALUE v_options){
632
677
 
633
678
  if(!NIL_P(v_addresses)){
634
679
  Check_Type(v_addresses, T_ARRAY);
635
- num_ip = RARRAY_LEN(v_addresses);
680
+ num_ip = (int)RARRAY_LEN(v_addresses);
636
681
  addrs = (struct sockaddr_in*)alloca(num_ip * sizeof(*addrs));
637
682
  }
638
683
  else{
@@ -641,7 +686,7 @@ static VALUE rsctp_sendv(VALUE self, VALUE v_options){
641
686
  }
642
687
 
643
688
  fileno = NUM2INT(rb_iv_get(self, "@fileno"));
644
- size = RARRAY_LEN(v_message);
689
+ size = (int)RARRAY_LEN(v_message);
645
690
 
646
691
  if(!size)
647
692
  rb_raise(rb_eArgError, "Must contain at least one message");
@@ -671,6 +716,9 @@ static VALUE rsctp_sendv(VALUE self, VALUE v_options){
671
716
  addrs[i].sin_family = domain;
672
717
  addrs[i].sin_port = htons(port);
673
718
  addrs[i].sin_addr.s_addr = inet_addr(StringValueCStr(v_address));
719
+ #ifdef BSD
720
+ addrs[i].sin_len = sizeof(struct sockaddr_in);
721
+ #endif
674
722
  }
675
723
  }
676
724
 
@@ -680,7 +728,7 @@ static VALUE rsctp_sendv(VALUE self, VALUE v_options){
680
728
  iov[i].iov_len = RSTRING_LEN(v_msg);
681
729
  }
682
730
 
683
- num_bytes = sctp_sendv(
731
+ num_bytes = (ssize_t)sctp_sendv(
684
732
  fileno,
685
733
  iov,
686
734
  size,
@@ -695,14 +743,15 @@ static VALUE rsctp_sendv(VALUE self, VALUE v_options){
695
743
  if(num_bytes < 0)
696
744
  rb_raise(rb_eSystemCallError, "sctp_sendv: %s", strerror(errno));
697
745
 
698
- return INT2NUM(num_bytes);
746
+ return LONG2NUM(num_bytes);
699
747
  }
700
748
  #endif
701
749
 
702
750
  #ifdef HAVE_SCTP_RECVV
703
751
  static VALUE rsctp_recvv(int argc, VALUE* argv, VALUE self){
704
752
  VALUE v_flags;
705
- int fileno, flags, bytes, on;
753
+ int fileno, flags, on;
754
+ ssize_t bytes;
706
755
  uint infotype;
707
756
  socklen_t infolen;
708
757
  struct iovec iov[1];
@@ -732,7 +781,7 @@ static VALUE rsctp_recvv(int argc, VALUE* argv, VALUE self){
732
781
  infolen = sizeof(struct sctp_rcvinfo);
733
782
  infotype = 0;
734
783
 
735
- bytes = sctp_recvv(
784
+ bytes = (ssize_t)sctp_recvv(
736
785
  fileno,
737
786
  iov,
738
787
  1,
@@ -849,7 +898,7 @@ static VALUE rsctp_send(VALUE self, VALUE v_options){
849
898
 
850
899
  fileno = NUM2INT(rb_iv_get(self, "@fileno"));
851
900
 
852
- num_bytes = sctp_send(
901
+ num_bytes = (ssize_t)sctp_send(
853
902
  fileno,
854
903
  StringValueCStr(v_msg),
855
904
  RSTRING_LEN(v_msg),
@@ -860,7 +909,7 @@ static VALUE rsctp_send(VALUE self, VALUE v_options){
860
909
  if(num_bytes < 0)
861
910
  rb_raise(rb_eSystemCallError, "sctp_send: %s", strerror(errno));
862
911
 
863
- return INT2NUM(num_bytes);
912
+ return LONG2NUM(num_bytes);
864
913
  }
865
914
 
866
915
  /*
@@ -901,7 +950,7 @@ static VALUE rsctp_sendmsg(VALUE self, VALUE v_options){
901
950
  uint32_t ppid, flags, ttl, context;
902
951
  ssize_t num_bytes;
903
952
  struct sockaddr_in addrs[8];
904
- int fileno, size;
953
+ int fileno, size, num_ip;
905
954
 
906
955
  Check_Type(v_options, T_HASH);
907
956
 
@@ -944,10 +993,10 @@ static VALUE rsctp_sendmsg(VALUE self, VALUE v_options){
944
993
  context = NUM2INT(v_context);
945
994
 
946
995
  if(!NIL_P(v_addresses)){
947
- int i, num_ip, port;
996
+ int i, port;
948
997
  VALUE v_address, v_port;
949
998
 
950
- num_ip = RARRAY_LEN(v_addresses);
999
+ num_ip = (int)RARRAY_LEN(v_addresses);
951
1000
  v_port = rb_hash_aref2(v_options, "port");
952
1001
 
953
1002
  if(NIL_P(v_port))
@@ -960,17 +1009,51 @@ static VALUE rsctp_sendmsg(VALUE self, VALUE v_options){
960
1009
  addrs[i].sin_family = NUM2INT(rb_iv_get(self, "@domain"));
961
1010
  addrs[i].sin_port = htons(port);
962
1011
  addrs[i].sin_addr.s_addr = inet_addr(StringValueCStr(v_address));
1012
+ #ifdef BSD
1013
+ addrs[i].sin_len = sizeof(struct sockaddr_in);
1014
+ #endif
963
1015
  }
964
1016
 
965
1017
  size = sizeof(addrs);
966
1018
  }
967
1019
  else{
1020
+ num_ip = 0;
968
1021
  size = 0;
969
1022
  }
970
1023
 
971
1024
  fileno = NUM2INT(rb_iv_get(self, "@fileno"));
972
1025
 
973
- num_bytes = sctp_sendmsg(
1026
+ #ifdef BSD
1027
+ if(num_ip){
1028
+ num_bytes = (ssize_t)sctp_sendmsgx(
1029
+ fileno,
1030
+ StringValueCStr(v_msg),
1031
+ RSTRING_LEN(v_msg),
1032
+ (struct sockaddr*)addrs,
1033
+ num_ip,
1034
+ ppid,
1035
+ flags,
1036
+ stream,
1037
+ ttl,
1038
+ context
1039
+ );
1040
+ }
1041
+ else{
1042
+ num_bytes = (ssize_t)sctp_sendmsg(
1043
+ fileno,
1044
+ StringValueCStr(v_msg),
1045
+ RSTRING_LEN(v_msg),
1046
+ (struct sockaddr*)addrs,
1047
+ size,
1048
+ ppid,
1049
+ flags,
1050
+ stream,
1051
+ ttl,
1052
+ context
1053
+ );
1054
+ }
1055
+ #else
1056
+ num_bytes = (ssize_t)sctp_sendmsg(
974
1057
  fileno,
975
1058
  StringValueCStr(v_msg),
976
1059
  RSTRING_LEN(v_msg),
@@ -982,11 +1065,20 @@ static VALUE rsctp_sendmsg(VALUE self, VALUE v_options){
982
1065
  ttl,
983
1066
  context
984
1067
  );
1068
+ #endif
985
1069
 
986
- if(num_bytes < 0)
1070
+ if(num_bytes < 0){
1071
+ #ifdef BSD
1072
+ if(num_ip > 0)
1073
+ rb_raise(rb_eSystemCallError, "sctp_sendmsgx: %s", strerror(errno));
1074
+ else
1075
+ rb_raise(rb_eSystemCallError, "sctp_sendmsg: %s", strerror(errno));
1076
+ #else
987
1077
  rb_raise(rb_eSystemCallError, "sctp_sendmsg: %s", strerror(errno));
1078
+ #endif
1079
+ }
988
1080
 
989
- return INT2NUM(num_bytes);
1081
+ return LONG2NUM(num_bytes);
990
1082
  }
991
1083
 
992
1084
  /*
@@ -1015,7 +1107,8 @@ static VALUE rsctp_recvmsg(int argc, VALUE* argv, VALUE self){
1015
1107
  VALUE v_flags, v_notification, v_message;
1016
1108
  struct sctp_sndrcvinfo sndrcvinfo;
1017
1109
  struct sockaddr_in clientaddr;
1018
- int flags, bytes, fileno;
1110
+ int flags, fileno;
1111
+ ssize_t bytes;
1019
1112
  char buffer[1024]; // TODO: Let this be configurable?
1020
1113
  socklen_t length;
1021
1114
 
@@ -1033,7 +1126,7 @@ static VALUE rsctp_recvmsg(int argc, VALUE* argv, VALUE self){
1033
1126
  bzero(&clientaddr, sizeof(clientaddr));
1034
1127
  bzero(&sndrcvinfo, sizeof(sndrcvinfo));
1035
1128
 
1036
- bytes = sctp_recvmsg(
1129
+ bytes = (ssize_t)sctp_recvmsg(
1037
1130
  fileno,
1038
1131
  buffer,
1039
1132
  sizeof(buffer),
@@ -1555,7 +1648,8 @@ static VALUE rsctp_get_subscriptions(VALUE self){
1555
1648
  if(sctp_opt_info(fileno, assoc_id, SCTP_EVENTS, (void*)&events, &size) < 0)
1556
1649
  rb_raise(rb_eSystemCallError, "sctp_opt_info: %s", strerror(errno));
1557
1650
 
1558
- return rb_struct_new(v_sctp_event_subscribe_struct,
1651
+ return rb_struct_new(
1652
+ v_sctp_event_subscribe_struct,
1559
1653
  (events.sctp_data_io_event ? Qtrue : Qfalse),
1560
1654
  (events.sctp_association_event ? Qtrue : Qfalse),
1561
1655
  (events.sctp_address_event ? Qtrue : Qfalse),
@@ -1565,11 +1659,19 @@ static VALUE rsctp_get_subscriptions(VALUE self){
1565
1659
  (events.sctp_partial_delivery_event ? Qtrue : Qfalse),
1566
1660
  (events.sctp_adaptation_layer_event ? Qtrue : Qfalse),
1567
1661
  (events.sctp_authentication_event ? Qtrue : Qfalse),
1568
- (events.sctp_sender_dry_event ? Qtrue : Qfalse),
1569
- (events.sctp_stream_reset_event ? Qtrue : Qfalse),
1570
- (events.sctp_assoc_reset_event ? Qtrue : Qfalse),
1571
- (events.sctp_stream_change_event ? Qtrue : Qfalse),
1572
- (events.sctp_send_failure_event_event ? Qtrue : Qfalse)
1662
+ (events.sctp_sender_dry_event ? Qtrue : Qfalse)
1663
+ #ifdef HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_STREAM_RESET_EVENT
1664
+ ,(events.sctp_stream_reset_event ? Qtrue : Qfalse)
1665
+ #endif
1666
+ #ifdef HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_ASSOC_RESET_EVENT
1667
+ ,(events.sctp_assoc_reset_event ? Qtrue : Qfalse)
1668
+ #endif
1669
+ #ifdef HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_STREAM_CHANGE_EVENT
1670
+ ,(events.sctp_stream_change_event ? Qtrue : Qfalse)
1671
+ #endif
1672
+ #ifdef HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_SEND_FAILURE_EVENT_EVENT
1673
+ ,(events.sctp_send_failure_event_event ? Qtrue : Qfalse)
1674
+ #endif
1573
1675
  );
1574
1676
  }
1575
1677
 
@@ -1724,6 +1826,40 @@ static VALUE rsctp_set_nodelay(VALUE self, VALUE v_bool){
1724
1826
  return Qfalse;
1725
1827
  }
1726
1828
 
1829
+ /*
1830
+ * call-seq:
1831
+ * SCTP::Socket#disable_fragments=(bool)
1832
+ *
1833
+ * This option is a on/off flag and is passed an integer where a non-
1834
+ * zero is on and a zero is off. If enabled no SCTP message
1835
+ * fragmentation will be performed. Instead if a message being sent
1836
+ * exceeds the current PMTU size, the message will NOT be sent and
1837
+ * instead a error will be indicated to the user.
1838
+ */
1839
+ static VALUE rsctp_disable_fragments(VALUE self, VALUE v_bool){
1840
+ int fileno;
1841
+ socklen_t size;
1842
+ sctp_assoc_t assoc_id;
1843
+ int value;
1844
+
1845
+ fileno = NUM2INT(rb_iv_get(self, "@fileno"));
1846
+ assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
1847
+ size = sizeof(int);
1848
+
1849
+ if(NIL_P(v_bool) || v_bool == Qfalse)
1850
+ value = 0;
1851
+ else
1852
+ value = 1;
1853
+
1854
+ if(sctp_opt_info(fileno, assoc_id, SCTP_DISABLE_FRAGMENTS, (void*)&value, &size) < 0)
1855
+ rb_raise(rb_eSystemCallError, "sctp_opt_info: %s", strerror(errno));
1856
+
1857
+ if(value)
1858
+ return Qtrue;
1859
+ else
1860
+ return Qfalse;
1861
+ }
1862
+
1727
1863
  /*
1728
1864
  * call-seq:
1729
1865
  * SCTP::Socket#autoclose
@@ -1845,7 +1981,8 @@ static VALUE rsctp_enable_auth_support(int argc, VALUE* argv, VALUE self){
1845
1981
  * otherwise this will set a key on the endpoint.
1846
1982
  */
1847
1983
  static VALUE rsctp_set_shared_key(int argc, VALUE* argv, VALUE self){
1848
- int fileno, len;
1984
+ int fileno;
1985
+ size_t len;
1849
1986
  char* key;
1850
1987
  uint keynum;
1851
1988
  socklen_t size;
@@ -1860,7 +1997,7 @@ static VALUE rsctp_set_shared_key(int argc, VALUE* argv, VALUE self){
1860
1997
  len = strlen(key);
1861
1998
  unsigned char byte_array[len+1];
1862
1999
 
1863
- for(int i = 0; i < len; i++)
2000
+ for(size_t i = 0; i < len; i++)
1864
2001
  byte_array[i] = key[i];
1865
2002
 
1866
2003
  byte_array[len] = '\0';
@@ -2164,6 +2301,7 @@ void Init_socket(void){
2164
2301
  rb_define_method(cSocket, "close", rsctp_close, 0);
2165
2302
  rb_define_method(cSocket, "connectx", rsctp_connectx, -1);
2166
2303
  rb_define_method(cSocket, "delete_shared_key", rsctp_delete_shared_key, -1);
2304
+ rb_define_method(cSocket, "disable_fragments=", rsctp_disable_fragments, 1);
2167
2305
  rb_define_method(cSocket, "enable_auth_support", rsctp_enable_auth_support, -1);
2168
2306
  rb_define_method(cSocket, "getpeernames", rsctp_getpeernames, -1);
2169
2307
  rb_define_method(cSocket, "getlocalnames", rsctp_getlocalnames, -1);
@@ -2206,8 +2344,8 @@ void Init_socket(void){
2206
2344
  rb_define_attr(cSocket, "association_id", 1, 1);
2207
2345
  rb_define_attr(cSocket, "port", 1, 1);
2208
2346
 
2209
- /* 0.1.1: The version of this library */
2210
- rb_define_const(cSocket, "VERSION", rb_str_new2("0.1.1"));
2347
+ /* 0.1.2: The version of this library */
2348
+ rb_define_const(cSocket, "VERSION", rb_str_new2("0.1.2"));
2211
2349
 
2212
2350
  /* send flags */
2213
2351
 
@@ -2230,7 +2368,9 @@ void Init_socket(void){
2230
2368
 
2231
2369
  // ASSOCIATION STATES //
2232
2370
 
2371
+ #ifdef HAVE_SCTP_EMPTY
2233
2372
  rb_define_const(cSocket, "SCTP_EMPTY", INT2NUM(SCTP_EMPTY));
2373
+ #endif
2234
2374
  rb_define_const(cSocket, "SCTP_CLOSED", INT2NUM(SCTP_CLOSED));
2235
2375
  rb_define_const(cSocket, "SCTP_COOKIE_WAIT", INT2NUM(SCTP_COOKIE_WAIT));
2236
2376
  rb_define_const(cSocket, "SCTP_COOKIE_ECHOED", INT2NUM(SCTP_COOKIE_ECHOED));
data/sctp-socket.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'sctp-socket'
3
- spec.version = '0.1.1'
3
+ spec.version = '0.1.2'
4
4
  spec.author = 'Daniel Berger'
5
5
  spec.email = 'djberg96@gmail.com'
6
6
  spec.summary = 'Ruby bindings for SCTP sockets'
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.1.1
4
+ version: 0.1.2
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: 2025-01-01 00:00:00.000000000 Z
38
+ date: 2025-01-10 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: bundler
metadata.gz.sig CHANGED
Binary file