SocketLibrary.java

  1. package org.jruby.ext.socket;

  2. import java.io.IOException;
  3. import org.jruby.Ruby;
  4. import org.jruby.platform.Platform;
  5. import org.jruby.runtime.load.Library;

  6. /**
  7.  *
  8.  * @author nicksieger
  9.  */
  10. public class SocketLibrary implements Library {
  11.     public void load(final Ruby runtime, boolean wrap) throws IOException {
  12.         runtime.defineClass("SocketError", runtime.getStandardError(), runtime.getStandardError().getAllocator());
  13.         RubyBasicSocket.createBasicSocket(runtime);
  14.         RubySocket.createSocket(runtime);
  15.         RubyServerSocket.createServerSocket(runtime);

  16.         if (runtime.getInstanceConfig().isNativeEnabled() && !Platform.IS_WINDOWS) {
  17.             RubyUNIXSocket.createUNIXSocket(runtime);
  18.             RubyUNIXServer.createUNIXServer(runtime);
  19.         }

  20.         RubyIPSocket.createIPSocket(runtime);
  21.         RubyTCPSocket.createTCPSocket(runtime);
  22.         RubyTCPServer.createTCPServer(runtime);
  23.         RubyUDPSocket.createUDPSocket(runtime);

  24.         Addrinfo.createAddrinfo(runtime);
  25.         Option.createOption(runtime);
  26.         Ifaddr.createIfaddr(runtime);
  27.     }
  28. }