|
|
| version 1.1, 2008/06/16 12:37:59 | version 1.3, 2009/04/10 11:31:06 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b inet parser class. | Parser: @b inet parser class. |
| Copyright(c) 2001-2005 ArtLebedev Group(http://www.artlebedev.com) | Copyright(c) 2001-2009 ArtLebedev Group(http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) |
| */ | */ |
| Line 25 DECLARE_CLASS_VAR(inet, new MInet, 0); | Line 25 DECLARE_CLASS_VAR(inet, new MInet, 0); |
| static void _ntoa(Request& r, MethodParams& params){ | static void _ntoa(Request& r, MethodParams& params){ |
| unsigned long l=(unsigned long)trunc(params.as_double(0, "parameter must be expression", r)); | unsigned long l=(unsigned long)trunc(params.as_double(0, "parameter must be expression", r)); |
| static const int ip_cstr_bufsize=3*4+3+1; | static const int ip_cstr_bufsize=3*4+3+1+1; |
| char* ip_cstr=new(PointerFreeGC) char[ip_cstr_bufsize]; | char* ip_cstr=new(PointerFreeGC) char[ip_cstr_bufsize]; |
| snprintf(ip_cstr, ip_cstr_bufsize, "%u.%u.%u.%u", | snprintf(ip_cstr, ip_cstr_bufsize, "%u.%u.%u.%u", |
| Line 90 MInet::MInet(): Methoded("inet") { | Line 90 MInet::MInet(): Methoded("inet") { |
| add_native_method("ntoa", Method::CT_STATIC, _ntoa, 1, 1); | add_native_method("ntoa", Method::CT_STATIC, _ntoa, 1, 1); |
| add_native_method("aton", Method::CT_STATIC, _aton, 1, 1); | add_native_method("aton", Method::CT_STATIC, _aton, 1, 1); |
| // todo: gethostbyname, gethostbyaddr | // @todo: gethostbyname, gethostbyaddr |
| } | } |