summaryrefslogtreecommitdiff
path: root/lib/dgram.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dgram.js')
-rw-r--r--lib/dgram.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/dgram.js b/lib/dgram.js
index cc61d4d274..d29d1e7b19 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -832,6 +832,55 @@ Socket.prototype.dropMembership = function(multicastAddress,
}
};
+Socket.prototype.addSourceSpecificMembership = function(sourceAddress,
+ groupAddress,
+ interfaceAddress) {
+ healthCheck(this);
+
+ if (typeof sourceAddress !== 'string') {
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'sourceAddress',
+ 'string');
+ }
+
+ if (typeof groupAddress !== 'string') {
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'groupAddress',
+ 'string');
+ }
+
+ const err =
+ this[kStateSymbol].handle.addSourceSpecificMembership(sourceAddress,
+ groupAddress,
+ interfaceAddress);
+ if (err) {
+ throw errnoException(err, 'addSourceSpecificMembership');
+ }
+};
+
+
+Socket.prototype.dropSourceSpecificMembership = function(sourceAddress,
+ groupAddress,
+ interfaceAddress) {
+ healthCheck(this);
+
+ if (typeof sourceAddress !== 'string') {
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'sourceAddress',
+ 'string');
+ }
+
+ if (typeof groupAddress !== 'string') {
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'groupAddress',
+ 'string');
+ }
+
+ const err =
+ this[kStateSymbol].handle.dropSourceSpecificMembership(sourceAddress,
+ groupAddress,
+ interfaceAddress);
+ if (err) {
+ throw errnoException(err, 'dropSourceSpecificMembership');
+ }
+};
+
function healthCheck(socket) {
if (!socket[kStateSymbol].handle) {