Module: FFI::Cups

Extended by:
Library
Defined in:
lib/ffi-cups/ffi/cups.rb,
lib/ffi-cups/ffi/array.rb,
lib/ffi-cups/ffi/http.rb

Overview

Defined Under Namespace

Modules: Array, Http

Instance Method Summary collapse

Instance Method Details

#cupsAddOption(string, string, int, pointer) ⇒ Integer

Add an option to an option array. https://www.cups.org/doc/cupspm.html#cupsAddOption

Returns number of options.

Parameters:

  • name (String)

    of option

  • value (String)

    of option

  • number (Integer)

    of options

  • pointer (Pointer)

    to options

Returns:

  • (Integer)

    number of options



176
# File 'lib/ffi-cups/ffi/cups.rb', line 176

attach_function 'cupsAddOption', [:string, :string, :int, :pointer], :int, blocking: true

#cupsCancelDestJob(string, int) ⇒ Integer

Returns IPP status.

Parameters:

  • connection (Pointer)

    to a http server

  • pointer (Pointer)

    to a destination

  • id (Integer)

    of the job

Returns:

  • (Integer)

    IPP status



91
# File 'lib/ffi-cups/ffi/cups.rb', line 91

attach_function 'cupsCancelDestJob', [:string, :int], :void, blocking: true

#cupsCancelJob(string, int) ⇒ Object

Cancel a job on a destination name

Parameters:

  • name (String)

    of the destination

  • id (Ingeger)

    of the job



97
# File 'lib/ffi-cups/ffi/cups.rb', line 97

attach_function 'cupsCancelJob', [:string, :int], :void, blocking: true

#cupsCancelJob2(pointer, string, int) ⇒ Object

Cancel a job on a destination

Parameters:

  • pointer (Pointer)

    of the http connection

  • name (String)

    of the destination

  • id (Ingeger)

    of the job



104
# File 'lib/ffi-cups/ffi/cups.rb', line 104

attach_function 'cupsCancelJob2', [:pointer, :string, :int], :void, blocking: true

#cupsCheckDestSupported(pointer, pointer, pointer, string, string) ⇒ Integer

Check that the option and value are supported by the destination. https://www.cups.org/doc/cupspm.html#cupsCheckDestSupported

Returns 1 if supported, 0 otherwise.

Parameters:

  • http (Pointer)
  • destination (Pointer)
  • dinfo (Pointer)
  • option (String)
  • value (String)

Returns:

  • (Integer)

    1 if supported, 0 otherwise



24
# File 'lib/ffi-cups/ffi/cups.rb', line 24

attach_function 'cupsCheckDestSupported', [:pointer, :pointer, :pointer, :string, :string], :int, blocking: true

#cupsCopyDestInfo(pointer, pointer) ⇒ Pointer

Get the supported values/capabilities for the destination. https://www.cups.org/doc/cupspm.html#cupsCopyDestInfo

Returns Destination information.

Parameters:

  • http (Pointer)
  • dest (Pointer)

Returns:

  • (Pointer)

    Destination information



32
# File 'lib/ffi-cups/ffi/cups.rb', line 32

attach_function 'cupsCopyDestInfo', [:pointer, :pointer], :pointer, blocking: true

#cupsCreateJob(pointer, string, string, int, pointer) ⇒ Integer

Create a job on a destination.

Returns job number or 0 on error.

Parameters:

  • pointer (Pointer)

    to http connection to server or CUPS_HTTP_DEFAULT

  • name (String)

    of the printer

  • title (String)

    of the job

  • number (Integer)

    of options

  • pointer (Pointer)

    to a Cups::Struct::Option object

Returns:

  • (Integer)

    job number or 0 on error



141
# File 'lib/ffi-cups/ffi/cups.rb', line 141

attach_function 'cupsCreateJob', [:pointer, :string, :string, :int, :pointer], :int, blocking: true

#cupsEncryptionInteger

Get the current encryption settings. https://www.cups.org/doc/cupspm.html#cupsEncryption

Returns:

  • (Integer)

    encryption settings



13
# File 'lib/ffi-cups/ffi/cups.rb', line 13

attach_function 'cupsEncryption', [], :int, blocking: true

#cupsFinishDocument(pointer, string) ⇒ Cups::Enum::IPP::Status

Returns IppStatus.

Parameters:

  • pointer (Pointer)

    to http connection to server or CUPS_HTTP_DEFAULT

  • name (String)

    of the printer

Returns:



166
# File 'lib/ffi-cups/ffi/cups.rb', line 166

attach_function 'cupsFinishDocument', [:pointer, :string], Cups::Enum::IPP::Status, blocking: true

#cupsFreeDests(int, pointer) ⇒ Object

Free the memory used by the list of destinations. https://www.cups.org/doc/cupspm.html#cupsFreeDests

Parameters:

  • number (Integer)

    of destinations

  • pointer (Pointer)

    to destinations



57
# File 'lib/ffi-cups/ffi/cups.rb', line 57

attach_function 'cupsFreeDests', [:int, :pointer], :void, blocking: true

#cupsFreeJobs(int, pointer) ⇒ Object

Parameters:

  • number (Integer)

    of jobs

  • pointer (Pointer)

    to the first Cups::Struct::Job to free



131
# File 'lib/ffi-cups/ffi/cups.rb', line 131

attach_function 'cupsFreeJobs', [:int, :pointer ], :void, blocking: true

#cupsFreeOptions(int, pointer) ⇒ Object

Free all memory used by options. https://www.cups.org/doc/cupspm.html#cupsFreeOptions

Parameters:

  • number (Integer)

    of options

  • pointer (Pointer)

    to options



183
# File 'lib/ffi-cups/ffi/cups.rb', line 183

attach_function 'cupsFreeOptions', [:int, :pointer], :void, blocking: true

#cupsGetDest(string, string, int, pointer) ⇒ Pointer, NULL

Get the named destination from the list. https://www.cups.org/doc/cupspm.html#cupsGetDest

Returns destination or NULL.

Parameters:

  • name (String)
  • instance (String)

    instance name or NULL

  • num_dests (Integer)

    number of destinations

  • destinations (Pointer)

Returns:

  • (Pointer, NULL)

    destination or NULL



42
# File 'lib/ffi-cups/ffi/cups.rb', line 42

attach_function 'cupsGetDest', [:string, :string, :int, :pointer], :pointer, blocking: true

#cupsGetDests2(pointer, pointer) ⇒ Integer

Get the list of destinations from the specified server. https://www.cups.org/doc/cupspm.html#cupsGetDests2

Returns number of destinations.

Parameters:

  • pointer (Pointer)

    to http connection for server or CUPS_HTTP_DEFAULT

  • pointer (Pointer)

    to destinations

Returns:

  • (Integer)

    number of destinations



50
# File 'lib/ffi-cups/ffi/cups.rb', line 50

attach_function 'cupsGetDests2', [:pointer, :pointer], :int, blocking: true

#cupsGetJobs(pointer, string, int, int) ⇒ Integer

Get the jobs

Returns number of jobs.

Parameters:

  • pointer (Pointer)

    to Cups::Struct::Job to populate

  • name (String)

    of the printer

  • number (Integer)

    of type of job (0 == all users, 1 == mine)

  • which (Integer)

    jobs (CUPS_WHICHJOBS_ALL, CUPS_WHICHJOBS_ACTIVE, or CUPS_WHICHJOBS_COMPLETED)

Returns:

  • (Integer)

    number of jobs



124
# File 'lib/ffi-cups/ffi/cups.rb', line 124

attach_function 'cupsGetJobs', [:pointer, :string, :int, :int], :int, blocking: true

#cupsGetJobs2(pointer, pointer, string, int, int) ⇒ Integer

Get the jobs from a connection https://www.cups.org/doc/cupspm.html#cupsGetJobs2

Returns number of jobs.

Parameters:

  • pointer (Pointer)

    to a http connection object

  • pointer (Pointer)

    to Cups::Struct::Job

  • name (String)

    of the printer

  • number (Integer)

    of type of job (0 == all users, 1 == mine)

  • which (Integer)

    jobs (CUPS_WHICHJOBS_ALL, CUPS_WHICHJOBS_ACTIVE, or CUPS_WHICHJOBS_COMPLETED)

Returns:

  • (Integer)

    number of jobs



115
# File 'lib/ffi-cups/ffi/cups.rb', line 115

attach_function 'cupsGetJobs2', [:pointer, :pointer, :string, :int, :int], :int, blocking: true

#cupsLastErrorStringString

Returns the last error in string format

Returns:

  • (String)

    error



82
# File 'lib/ffi-cups/ffi/cups.rb', line 82

attach_function 'cupsLastErrorString', [], :string, blocking: true

#cupsPrintFile(string, string, string, int, pointer) ⇒ Integer

Prints a File

Returns job number or 0 on error.

Parameters:

  • name (String)

    of the printer

  • name (String)

    of the file

  • title (String)

    of the job

  • number (Integer)

    of options

  • pointer (Pointer)

    to a CupsOptionS struct

Returns:

  • (Integer)

    job number or 0 on error



67
# File 'lib/ffi-cups/ffi/cups.rb', line 67

attach_function 'cupsPrintFile', [ :string, :string, :string, :int, :pointer ], :int, blocking: true

#cupsPrintFile2(pointer, string, string, string, int, pointer) ⇒ Integer

Prints a file from a specific connection

Returns number of the job or 0 on error.

Parameters:

  • pointer (Pointer)

    to an http connection

  • name (String)

    of the printer

  • name (String)

    of the file

  • title (String)

    of the title

  • number (Integer)

    of options

  • pointer (Pointer)

    to a CupsOptionS struct

Returns:

  • (Integer)

    number of the job or 0 on error



78
# File 'lib/ffi-cups/ffi/cups.rb', line 78

attach_function 'cupsPrintFile2', [ :pointer, :string, :string, :string, :int, :pointer ], :int, blocking: true

#cupsStartDocument(pointer, string, int, string, string, int) ⇒ Cups::Enum::HTTP::Status

Returns HttpStatus.

Parameters:

  • pointer (Pointer)

    to http connection to server or CUPS_HTTP_DEFAULT

  • name (String)

    of the printer

  • id (Integer)

    of the job

  • name (String)

    of the document

  • mime_type (String)

    format of the document

  • number (Integer)

    of the last document (1 for last document in job, 0 otherwise)

Returns:



153
# File 'lib/ffi-cups/ffi/cups.rb', line 153

attach_function 'cupsStartDocument', [:pointer, :string, :int, :string, :string, :int], Cups::Enum::HTTP::Status, blocking: true

#cupsWriteRequestData(pointer, pointer, bytesize) ⇒ Cups::Enum::HTTP::Status

Returns HttpStatus.

Parameters:

  • pointer (Pointer)

    to http connection to server or CUPS_HTTP_DEFAULT

  • data (Pointer)

    in a character string pointer

  • length (Byte)

    of data

Returns:



160
# File 'lib/ffi-cups/ffi/cups.rb', line 160

attach_function 'cupsWriteRequestData', [:pointer, :pointer, :size_t], Cups::Enum::HTTP::Status, blocking: true