@ -33,6 +33,7 @@
namespace node {
namespace node {
using v8 : : AccessorInfo ;
using v8 : : Arguments ;
using v8 : : Arguments ;
using v8 : : Function ;
using v8 : : Function ;
using v8 : : FunctionTemplate ;
using v8 : : FunctionTemplate ;
@ -42,6 +43,7 @@ using v8::Integer;
using v8 : : Local ;
using v8 : : Local ;
using v8 : : Object ;
using v8 : : Object ;
using v8 : : Persistent ;
using v8 : : Persistent ;
using v8 : : PropertyAttribute ;
using v8 : : String ;
using v8 : : String ;
using v8 : : Value ;
using v8 : : Value ;
@ -91,6 +93,15 @@ void UDPWrap::Initialize(Handle<Object> target) {
t - > InstanceTemplate ( ) - > SetInternalFieldCount ( 1 ) ;
t - > InstanceTemplate ( ) - > SetInternalFieldCount ( 1 ) ;
t - > SetClassName ( String : : NewSymbol ( " UDP " ) ) ;
t - > SetClassName ( String : : NewSymbol ( " UDP " ) ) ;
enum PropertyAttribute attributes =
static_cast < PropertyAttribute > ( v8 : : ReadOnly | v8 : : DontDelete ) ;
t - > InstanceTemplate ( ) - > SetAccessor ( String : : New ( " fd " ) ,
UDPWrap : : GetFD ,
NULL ,
Handle < Value > ( ) ,
v8 : : DEFAULT ,
attributes ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " bind " , Bind ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " bind " , Bind ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " send " , Send ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " send " , Send ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " bind6 " , Bind6 ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " bind6 " , Bind6 ) ;
@ -124,6 +135,19 @@ Handle<Value> UDPWrap::New(const Arguments& args) {
return scope . Close ( args . This ( ) ) ;
return scope . Close ( args . This ( ) ) ;
}
}
Handle < Value > UDPWrap : : GetFD ( Local < String > , const AccessorInfo & args ) {
# if defined(_WIN32)
return v8 : : Null ( node_isolate ) ;
# else
HandleScope scope ;
UNWRAP ( UDPWrap )
int fd = ( wrap = = NULL ) ? - 1 : wrap - > handle_ . io_watcher . fd ;
return scope . Close ( Integer : : New ( fd , node_isolate ) ) ;
# endif
}
Handle < Value > UDPWrap : : DoBind ( const Arguments & args , int family ) {
Handle < Value > UDPWrap : : DoBind ( const Arguments & args , int family ) {
HandleScope scope ;
HandleScope scope ;
int r ;
int r ;