Module: XS

Defined in:
lib/ffi-rxs.rb,
lib/ffi-rxs/poll.rb,
lib/ffi-rxs/util.rb,
lib/ffi-rxs/libxs.rb,
lib/ffi-rxs/socket.rb,
lib/ffi-rxs/message.rb,
lib/ffi-rxs/version.rb,
lib/ffi-rxs/context.rb,
lib/ffi-rxs/constants.rb,
lib/ffi-rxs/exceptions.rb,
lib/ffi-rxs/poll_items.rb

Defined Under Namespace

Modules: CommonSocketBehavior, IdentitySupport, LibXS Classes: Context, ContextError, ManagedMessage, Message, MessageError, PollItems, Poller, Socket, Util, XSError

Constant Summary

LIBPATH =
::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
VERSION =
"1.2.1"
MAX_SOCKETS =

Context options

1
IO_THREADS =
2
PAIR =

Socket types

0
PUB =
1
SUB =
2
REQ =
3
REP =
4
XREQ =
5
XREP =
6
PULL =
7
PUSH =
8
XPUB =
9
XSUB =
10
SURVEYOR =
11
RESPONDENT =
12
XSURVEYOR =
13
XRESPONDENT =
14
DEALER =
XREQ
ROUTER =
XREP
SocketTypeNameMap =
{
  PAIR => "PAIR",
  PUB => "PUB",
  SUB => "SUB",
  REQ => "REQ",
  REP => "REP",
  PULL => "PULL",
  PUSH => "PUSH",
  XREQ => "XREQ",
  XREP => "XREP",
  ROUTER => "ROUTER",
  DEALER => "DEALER",
  XPUB => "XPUB",
  XSUB => "XSUB",
  SURVEYOR => "SURVEYOR",
  RESPONDENT => "RESPONDENT",
  XSURVEYOR => "XSURVEYOR",
  XRESPONDENT => "XRESPONDENT"
}
AFFINITY =

Socket options

4
IDENTITY =
5
SUBSCRIBE =
6
UNSUBSCRIBE =
7
RATE =
8
RECOVERY_IVL =
9
SNDBUF =
11
RCVBUF =
12
RCVMORE =
13
FD =
14
EVENTS =
15
TYPE =
16
LINGER =
17
RECONNECT_IVL =
18
BACKLOG =
19
RECONNECT_IVL_MAX =
21
MAXMSGSIZE =
22
SNDHWM =
23
RCVHWM =
24
MULTICAST_HOPS =
25
RCVTIMEO =
27
SNDTIMEO =
28
IPV4ONLY =
31
KEEPALIVE =
32
PROTOCOL =
33
SURVEY_TIMEOUT =
34
MORE =

Message options

1
DONTWAIT =

Send/recv options

1
SNDMORE =
2
NonBlocking =
DONTWAIT
POLLIN =

I/O multiplexing

1
POLLOUT =
2
POLLERR =
4
EAGAIN =

Socket errors

Errno::EAGAIN::Errno
EFAULT =
Errno::EFAULT::Errno
EINVAL =
Errno::EINVAL::Errno
EMFILE =
Errno::EMFILE::Errno
ENOMEM =
Errno::ENOMEM::Errno
ENODEV =
Errno::ENODEV::Errno
HAUSNUMERO =

XS errors

156384712
EMTHREAD =
(HAUSNUMERO + 50)
EFSM =
(HAUSNUMERO + 51)
ENOCOMPATPROTO =
(HAUSNUMERO + 52)
ETERM =
(HAUSNUMERO + 53)
ENOTSUP =

Rescue unknown constants and use the Crossroads defined values. Usually only happens on Windows although some do not resolve on OSX either ENOTSUP

Errno::ENOTSUP::Errno rescue (HAUSNUMERO + 1)
EPROTONOSUPPORT =
Errno::EPROTONOSUPPORT::Errno rescue (HAUSNUMERO + 2)
ENOBUFS =
Errno::ENOBUFS::Errno rescue (HAUSNUMERO + 3)
ENETDOWN =
Errno::ENETDOWN::Errno rescue (HAUSNUMERO + 4)
EADDRINUSE =
Errno::EADDRINUSE::Errno rescue (HAUSNUMERO + 5)
EADDRNOTAVAIL =
Errno::EADDRNOTAVAIL::Errno rescue (HAUSNUMERO + 6)
ECONNREFUSED =
Errno::ECONNREFUSED::Errno rescue (HAUSNUMERO + 7)
EINPROGRESS =
Errno::EINPROGRESS::Errno rescue (HAUSNUMERO + 8)
ENOTSOCK =
Errno::ENOTSOCK::Errno rescue (HAUSNUMERO + 9)
EINTR =
Errno::EINTR::Errno rescue (HAUSNUMERO + 10)

Class Method Summary (collapse)

Class Method Details

+ (Object) libpath(*args, &block)

Returns the library path for the module. If any arguments are given, they will be joined to the end of the library path using File.join.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ffi-rxs.rb', line 16

def self.libpath( *args, &block )
  rv =  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
  if block
    begin
      $LOAD_PATH.unshift LIBPATH
      rv = block.call
    ensure
      $LOAD_PATH.shift
    end
  end
  return rv
end

+ (Object) path(*args, &block)

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ffi-rxs.rb', line 32

def self.path( *args, &block )
  rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
  if block
    begin
      $LOAD_PATH.unshift PATH
      rv = block.call
    ensure
      $LOAD_PATH.shift
    end
  end
  return rv
end

+ (Object) require_all_libs_relative_to(fname, dir = nil)

Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



49
50
51
52
53
54
55
# File 'lib/ffi-rxs.rb', line 49

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= ::File.basename(fname, '.*')
  search_me = ::File.expand_path(
  ::File.join(::File.dirname(fname), dir, '**', '*.rb'))

  Dir.glob(search_me).sort.each {|rb| require rb}
end

+ (Object) version

Returns the version string for the library.



9
10
11
# File 'lib/ffi-rxs.rb', line 9

def self.version
  @version ||= File.read(path('version.txt')).strip
end