sctp-socket 0.1.3 → 0.1.4
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/CHANGES.md +6 -0
- data/ext/sctp/socket.c +134 -3
- data/sctp-socket.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 9a53fb8e5953dbf9ca5c45e273ab45d4982ade9ec4b77e44657cd826757fb8ef
|
4
|
+
data.tar.gz: 8d3aa7a1087c0f348cf25d8dde354fcb5bfba61b7a9c6db78cf60922496bf983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e23832cbb9cc0b8741ef696ed97aa494c17a12cc22bbf2b6eeaaab401cd654efb9b9966913557d2d442ae694e698c081c147d6b448d88876efecc831254c0d7
|
7
|
+
data.tar.gz: 17617bb21948741bc3397c9528bf283c5a07ec6bc06b57f7db17b925236025738cbe72390d7cb9ceb791d4b992ecba438d0a5ef3752baffc1d3b676fff5c719c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.1.4 - 1-Feb-2025
|
2
|
+
* Added the set_retransmission_info method.
|
3
|
+
* Added the get_rto_info and set_rto_info aliases.
|
4
|
+
* Added the set_association_info method.
|
5
|
+
* Some spec updates and refactoring.
|
6
|
+
|
1
7
|
## 0.1.3 - 22-Jan-2025
|
2
8
|
* The close method now accepts an optional `linger` argument.
|
3
9
|
* The bindx method now accepts an optional `reuse_addr` argument.
|
data/ext/sctp/socket.c
CHANGED
@@ -1528,6 +1528,75 @@ static VALUE rsctp_get_association_info(VALUE self){
|
|
1528
1528
|
);
|
1529
1529
|
}
|
1530
1530
|
|
1531
|
+
/*
|
1532
|
+
* call-seq:
|
1533
|
+
* SCTP::Socket#set_association_info(options)
|
1534
|
+
*
|
1535
|
+
* Sets the association specific parameters. The +options+ parameter
|
1536
|
+
* is a hash that accepts the following keywords:
|
1537
|
+
*
|
1538
|
+
* * association_id
|
1539
|
+
* * max_retransmission_count
|
1540
|
+
* * number_peer_destinations
|
1541
|
+
* * peer_receive_window
|
1542
|
+
* * local_receive_window
|
1543
|
+
* * cookie_life
|
1544
|
+
*
|
1545
|
+
* All values that refer to time values are measured in milliseconds.
|
1546
|
+
*/
|
1547
|
+
static VALUE rsctp_set_association_info(VALUE self, VALUE v_options){
|
1548
|
+
VALUE v_assoc_id, v_max_rxt, v_nbr_peer, v_peer_rw, v_local_rw, v_cookie;
|
1549
|
+
int fileno;
|
1550
|
+
sctp_assoc_t assoc_id;
|
1551
|
+
struct sctp_assocparams assoc;
|
1552
|
+
|
1553
|
+
bzero(&assoc, sizeof(assoc));
|
1554
|
+
|
1555
|
+
fileno = NUM2INT(rb_iv_get(self, "@fileno"));
|
1556
|
+
|
1557
|
+
v_assoc_id = rb_hash_aref2(v_options, "association_id");
|
1558
|
+
v_max_rxt = rb_hash_aref2(v_options, "max_retransmission_count");
|
1559
|
+
v_nbr_peer = rb_hash_aref2(v_options, "number_peer_destinations");
|
1560
|
+
v_peer_rw = rb_hash_aref2(v_options, "peer_receive_window");
|
1561
|
+
v_local_rw = rb_hash_aref2(v_options, "local_receive_window");
|
1562
|
+
v_cookie = rb_hash_aref2(v_options, "cookie_life");
|
1563
|
+
|
1564
|
+
if(NIL_P(v_assoc_id))
|
1565
|
+
assoc_id = NUM2INT(rb_iv_get(self, "@association_id"));
|
1566
|
+
else
|
1567
|
+
assoc_id = NUM2INT(v_assoc_id);
|
1568
|
+
|
1569
|
+
assoc.sasoc_assoc_id = assoc_id;
|
1570
|
+
|
1571
|
+
if(!NIL_P(v_max_rxt))
|
1572
|
+
assoc.sasoc_asocmaxrxt = NUM2INT(v_max_rxt);
|
1573
|
+
|
1574
|
+
if(!NIL_P(v_nbr_peer))
|
1575
|
+
assoc.sasoc_number_peer_destinations = NUM2INT(v_nbr_peer);
|
1576
|
+
|
1577
|
+
if(!NIL_P(v_peer_rw))
|
1578
|
+
assoc.sasoc_peer_rwnd = NUM2INT(v_peer_rw);
|
1579
|
+
|
1580
|
+
if(!NIL_P(v_local_rw))
|
1581
|
+
assoc.sasoc_local_rwnd = NUM2INT(v_local_rw);
|
1582
|
+
|
1583
|
+
if(!NIL_P(v_cookie))
|
1584
|
+
assoc.sasoc_cookie_life = NUM2INT(v_cookie);
|
1585
|
+
|
1586
|
+
if(setsockopt(fileno, IPPROTO_SCTP, SCTP_ASSOCINFO, &assoc, sizeof(assoc)) < 0)
|
1587
|
+
rb_raise(rb_eSystemCallError, "setsockopt: %s", strerror(errno));
|
1588
|
+
|
1589
|
+
return rb_struct_new(
|
1590
|
+
v_sctp_associnfo_struct,
|
1591
|
+
INT2NUM(assoc.sasoc_assoc_id),
|
1592
|
+
INT2NUM(assoc.sasoc_asocmaxrxt),
|
1593
|
+
INT2NUM(assoc.sasoc_number_peer_destinations),
|
1594
|
+
INT2NUM(assoc.sasoc_peer_rwnd),
|
1595
|
+
INT2NUM(assoc.sasoc_local_rwnd),
|
1596
|
+
INT2NUM(assoc.sasoc_cookie_life)
|
1597
|
+
);
|
1598
|
+
}
|
1599
|
+
|
1531
1600
|
/*
|
1532
1601
|
* call-seq:
|
1533
1602
|
* SCTP::Socket#shutdown
|
@@ -1602,6 +1671,64 @@ static VALUE rsctp_get_retransmission_info(VALUE self){
|
|
1602
1671
|
);
|
1603
1672
|
}
|
1604
1673
|
|
1674
|
+
/*
|
1675
|
+
* call-seq:
|
1676
|
+
* SCTP::Socket#set_retransmission_info(options)
|
1677
|
+
*
|
1678
|
+
* Sets the protocol parameters that are used to initialize and bind the
|
1679
|
+
* retransmission timeout (RTO) tunable. The method accepts a hash with
|
1680
|
+
* the following possible keys:
|
1681
|
+
*
|
1682
|
+
* * association_id
|
1683
|
+
* * initial
|
1684
|
+
* * max
|
1685
|
+
* * min
|
1686
|
+
*
|
1687
|
+
* The +initial+, +max+ and +min+ options default to zero (unchanged).
|
1688
|
+
*/
|
1689
|
+
static VALUE rsctp_set_retransmission_info(VALUE self, VALUE v_options){
|
1690
|
+
VALUE v_assoc_id, v_initial, v_max, v_min;
|
1691
|
+
int fileno;
|
1692
|
+
sctp_assoc_t assoc_id;
|
1693
|
+
struct sctp_rtoinfo rto;
|
1694
|
+
|
1695
|
+
bzero(&rto, sizeof(rto));
|
1696
|
+
|
1697
|
+
fileno = NUM2INT(rb_iv_get(self, "@fileno"));
|
1698
|
+
|
1699
|
+
v_assoc_id = rb_hash_aref2(v_options, "association_id");
|
1700
|
+
v_initial = rb_hash_aref2(v_options, "initial");
|
1701
|
+
v_max = rb_hash_aref2(v_options, "max");
|
1702
|
+
v_min = rb_hash_aref2(v_options, "min");
|
1703
|
+
|
1704
|
+
if(NIL_P(v_assoc_id))
|
1705
|
+
v_assoc_id = rb_iv_get(self, "@association_id");
|
1706
|
+
|
1707
|
+
assoc_id = NUM2INT(v_assoc_id);
|
1708
|
+
|
1709
|
+
rto.srto_assoc_id = assoc_id;
|
1710
|
+
|
1711
|
+
if(!NIL_P(v_initial))
|
1712
|
+
rto.srto_initial = NUM2INT(v_initial);
|
1713
|
+
|
1714
|
+
if(!NIL_P(v_max))
|
1715
|
+
rto.srto_max = NUM2INT(v_max);
|
1716
|
+
|
1717
|
+
if(!NIL_P(v_min))
|
1718
|
+
rto.srto_min = NUM2INT(v_min);
|
1719
|
+
|
1720
|
+
if(setsockopt(fileno, IPPROTO_SCTP, SCTP_RTOINFO, &rto, sizeof(rto)) < 0)
|
1721
|
+
rb_raise(rb_eSystemCallError, "setsockopt: %s", strerror(errno));
|
1722
|
+
|
1723
|
+
return rb_struct_new(
|
1724
|
+
v_sctp_rtoinfo_struct,
|
1725
|
+
v_assoc_id,
|
1726
|
+
v_initial,
|
1727
|
+
v_max,
|
1728
|
+
v_min
|
1729
|
+
);
|
1730
|
+
}
|
1731
|
+
|
1605
1732
|
/*
|
1606
1733
|
* call-seq:
|
1607
1734
|
* SCTP::Socket#get_status
|
@@ -2391,20 +2518,24 @@ void Init_socket(void){
|
|
2391
2518
|
|
2392
2519
|
rb_define_method(cSocket, "sendmsg", rsctp_sendmsg, 1);
|
2393
2520
|
rb_define_method(cSocket, "set_active_shared_key", rsctp_set_active_shared_key, -1);
|
2521
|
+
rb_define_method(cSocket, "set_association_info", rsctp_set_association_info, 1);
|
2394
2522
|
rb_define_method(cSocket, "set_initmsg", rsctp_set_initmsg, 1);
|
2395
|
-
|
2523
|
+
rb_define_method(cSocket, "set_retransmission_info", rsctp_set_retransmission_info, 1);
|
2396
2524
|
rb_define_method(cSocket, "set_shared_key", rsctp_set_shared_key, -1);
|
2397
2525
|
rb_define_method(cSocket, "shutdown", rsctp_shutdown, -1);
|
2398
2526
|
rb_define_method(cSocket, "subscribe", rsctp_subscribe, 1);
|
2399
2527
|
|
2528
|
+
rb_define_alias(cSocket, "get_rto_info", "get_retransmission_info");
|
2529
|
+
rb_define_alias(cSocket, "set_rto_info", "set_retransmission_info");
|
2530
|
+
|
2400
2531
|
rb_define_attr(cSocket, "domain", 1, 1);
|
2401
2532
|
rb_define_attr(cSocket, "type", 1, 1);
|
2402
2533
|
rb_define_attr(cSocket, "fileno", 1, 1);
|
2403
2534
|
rb_define_attr(cSocket, "association_id", 1, 1);
|
2404
2535
|
rb_define_attr(cSocket, "port", 1, 1);
|
2405
2536
|
|
2406
|
-
/* 0.1.
|
2407
|
-
rb_define_const(cSocket, "VERSION", rb_str_new2("0.1.
|
2537
|
+
/* 0.1.4: The version of this library */
|
2538
|
+
rb_define_const(cSocket, "VERSION", rb_str_new2("0.1.4"));
|
2408
2539
|
|
2409
2540
|
/* send flags */
|
2410
2541
|
|
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.1.
|
4
|
+
version: 0.1.4
|
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
|
38
|
+
date: 2025-02-01 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|