Sha256: 60adadd4b8b5f88537246d073d2ad9edbead4e87da0575761c269da8f8ca7760

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

require 'ffi'

module OpenSLP
  module Functions
    extend FFI::Library

    # Look for either slp or libslip
    begin
      ffi_lib :libslp
    rescue LoadError
      begin
        ffi_lib :slp
      rescue LoadError
        if File::ALT_SEPARATOR
          ffi_lib "C:/Program Files (x86)/OpenSLP/slp"
        else
          raise
        end
      end
    end

    typedef :ulong, :handle

    callback :SLPSrvURLCallback, [:handle, :string, :ushort, :int, :pointer], :bool
    callback :SLPSrvTypeCallback, [:handle, :string, :int, :pointer], :bool
    callback :SLPAttrCallback, [:handle, :string, :int, :pointer], :bool
    callback :SLPRegReportCallback, [:handle, :int, :pointer], :void

    attach_function :SLPClose, [:handle], :void
    attach_function :SLPEscape, [:string, :pointer, :bool], :int
    attach_function :SLPDelAttrs, [:handle, :string, :string, :SLPRegReportCallback, :pointer], :int
    attach_function :SLPDereg, [:handle, :string, :SLPRegReportCallback, :pointer], :int

    attach_function :SLPFindAttrs,
      [:handle, :string, :string, :string, :SLPAttrCallback, :pointer], :int

    attach_function :SLPFindScopes, [:handle, :pointer], :int

    attach_function :SLPFindSrvs,
      [:handle, :string, :string, :string, :SLPSrvURLCallback, :pointer], :int

    attach_function :SLPFindSrvTypes,
      [:handle, :string, :string, :SLPSrvTypeCallback, :pointer], :int

    attach_function :SLPFree, [:pointer], :void
    attach_function :SLPGetProperty, [:string], :string
    attach_function :SLPGetRefreshInterval, [], :uint
    attach_function :SLPOpen, [:string, :bool, :pointer], :handle
    attach_function :SLPParseSrvURL, [:string, :pointer], :int
    attach_function :SLPReg, [:handle, :string, :ushort, :string, :string, :bool, :SLPRegReportCallback, :pointer], :int
    attach_function :SLPSetProperty, [:string, :string], :void
    attach_function :SLPUnescape, [:string, :pointer, :bool], :int
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rslp-0.0.1 lib/slp/functions.rb