#include #include #include #include #include #define nodeparam v8::FunctionCallbackInfo namespace ioctlNode { void nodeSocket(const nodeparam& args) { v8::Isolate* isolate = args.GetIsolate(); if (args.Length() != 3 || !args[0]->IsUint32() || !args[1]->IsUint32() || !args[2]->IsUint32()) { isolate->ThrowException(v8::Exception::TypeError( v8::String::NewFromUtf8(isolate, "Argument 1, 2 & 3 must be numbers").ToLocalChecked())); return; } const int domain = args[0].As()->Value(); const int type = args[1].As()->Value(); const int protocol = args[2].As()->Value(); args.GetReturnValue().Set(socket(domain ,type, protocol)); } void Initialize(v8::Local exports) { NODE_SET_METHOD(exports, "socket", nodeSocket); } NODE_MODULE(ioctl_api, Initialize) }