module NIS
NIS
module providing the yp functions.
Constants
- YPERR_ACCESS
- YPERR_BADARGS
- YPERR_BADDB
- YPERR_BUSY
- YPERR_DOMAIN
- YPERR_KEY
- YPERR_MAP
- YPERR_NODOM
- YPERR_NOMORE
- YPERR_PMAP
- YPERR_RESRC
- YPERR_RPC
- YPERR_SUCCESS
- YPERR_VERS
- YPERR_YPBIND
- YPERR_YPERR
- YPERR_YPSERV
Public Class Methods
yp_get_default_domain()
click to toggle source
Get the default domain.
# 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)
click to toggle source
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).
# 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)
click to toggle source
Returns an error string which describes the error code.
# File lib/nis-ffi.rb, line 82 def self.yperr_string(code) Library.yperr_string(code) end
Private Class Methods
raise_on_error(code)
click to toggle source
# File lib/nis-ffi.rb, line 88 def self.raise_on_error(code) if code != YPERR_SUCCESS message = yperr_string(code) raise YPError.new(code, message) end end