Module: NIS
- Defined in:
- lib/nis-ffi.rb,
lib/nis-ffi/version.rb
Overview
NIS module providing the yp functions.
Defined Under Namespace
Modules: Library, Version Classes: YPError
Constant Summary collapse
- YPERR_SUCCESS =
0- YPERR_BADARGS =
1- YPERR_RPC =
2- YPERR_DOMAIN =
3- YPERR_MAP =
4- YPERR_KEY =
5- YPERR_YPERR =
6- YPERR_RESRC =
7- YPERR_NOMORE =
8- YPERR_PMAP =
9- YPERR_YPBIND =
10- YPERR_YPSERV =
11- YPERR_NODOM =
12- YPERR_BADDB =
13- YPERR_VERS =
14- YPERR_ACCESS =
15- YPERR_BUSY =
16
Class Method Summary collapse
-
.yp_get_default_domain ⇒ Object
Get the default domain.
-
.yp_match(domain, map, key) ⇒ Object
Look up a value with a specified map and key.
-
.yperr_string(code) ⇒ Object
Returns an error string which describes the error code.
Class Method Details
.yp_get_default_domain ⇒ Object
Get the default domain.
56 57 58 59 60 61 62 |
# File 'lib/nis-ffi.rb', line 56 def self.yp_get_default_domain domain_ptr = FFI::MemoryPointer.new(:pointer) code = Library.yp_get_default_domain(domain_ptr) raise_on_error(code) str_ptr = domain_ptr.read_pointer str_ptr.read_string end |
.yp_match(domain, map, key) ⇒ Object
Look up a value with a specified map and key.
Returns the string value or raises an YPError (even when it’s just a key that doesn’t exist).
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/nis-ffi.rb', line 68 def self.yp_match(domain, map, key) value = FFI::MemoryPointer.new(:pointer) value_len = FFI::MemoryPointer.new(:int) code = Library.yp_match(domain, map, key, key.bytesize, value, value_len) raise_on_error(code) str_ptr = value.read_pointer len = value_len.read_int result = str_ptr.read_string(len) result end |
.yperr_string(code) ⇒ Object
Returns an error string which describes the error code.
82 83 84 |
# File 'lib/nis-ffi.rb', line 82 def self.yperr_string(code) Library.yperr_string(code) end |