The following routines are found in the C library
$JUKE_DIR/lib/jukeclnt.a and header files are in
$JUKE_DIR/include/jukeclnt.h.
jcl_apply
jcl_apply(JCL_HANDLE ch, int (*func)(JCL_HANDLE, JGP_LOCATION))
Call the indicated function on every location in the jukebox. The function must take two arguments, a jukebox client handle, and a location number. (i.e. jcl_listloc(), jcl_initloc()) Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_apply_drive
jcl_apply_drive(JCL_HANDLE ch, int (*func)(JCL_HANDLE, JGP_LOCATION))
call the passed in function to every drive location in the jukebox The function must take two arguments, a jukebox client handle, and a location number. (i.e. jcl_listloc(), jcl_initloc()) Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_apply_port
jcl_apply_port(JCL_HANDLE ch, int (*func)(JCL_HANDLE, JGP_LOCATION))
call the passed in function to every port location in the jukebox The function must take two arguments, a jukebox client handle, and a location number. (i.e. jcl_listloc(), jcl_initloc()) Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_apply_slot
jcl_apply_slot(JCL_HANDLE ch, int (*func)(JCL_HANDLE, JGP_LOCATION))
call the passed in function to every slot location in the jukebox The function must take two arguments, a jukebox client handle, and a location number. (i.e. jcl_listloc(), jcl_initloc()) Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_close
jcl_close(JCL_HANDLE ch)
Call this when you're done with a given jukebox handle. Frees up the client data structure pointed to by the handle after closing the server connection jukebox stuff, and dropping the rpc connection. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_diagnose
jcl_diagnose( JCL_HANDLE ch, nDiag )
put the jukebox diagnose, just call jsv_diagnose Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_display
jcl_display( JCL_HANDLE ch, nDiag )
set the jukebox display message, just call jsv_display If the message is "" the default message should put on the display. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_drive2loc
jcl_drive2loc(JCL_HANDLE ch, char *pcName, JGP_LOCATION *pl)
Converts a drive string to a location, it can be either a number, or a device name; the former will be convereed with the jgp.h DRIVLOC macro, or a tape name. the device name will be looked up in the drive name list we got from the config file. If its a POSIX compliant system, it takes the last component of the /dir/dir/.../file path. It matches names that are prefixes of name user gave, hence the strncasecmp(...strlen()) stuff; i.e. "/dev/rmt/tps0d3nrnsv" matches "tps0d3" Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_export
jcl_export(JCL_HANDLE ch, JGP_LOCATION lport , JGP_LOCATION lsrc )
export a tape by moving it from lsrc to the lport port, uncovering the port, asking the user to tell us when they have it, and then covering the port allocating an arm and waiting as neccesary Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getarms
jcl_getArms(JCL_HANDLE ch, JGP_LOCATION l, int *pn)
Get the number of arms in the jukebox. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getdate
jcl_getDate(JCL_HANDLE ch, JGP_LOCATION l, time_t *pt)
get the date stamp of the media in a given location; this is generally the date of the last time it was renamed or imported. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getdrives
jcl_getDrives(JCL_HANDLE ch, JGP_LOCATION l, int *pn)
Get the number of tape drives in the jukebox. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getname
jcl_getName(JCL_HANDLE ch, JGP_LOCATION l, char **ppcName)
get the name of the media in a given location; note the same buffer is used for all getName calls, so the next getName will overwrite the buffer; strcpy() it out if you want to keep it... Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getports
jcl_getPorts(JCL_HANDLE ch, JGP_LOCATION l, int *pn)
Get the number of mailbox (tape exchange) ports in the jukebox. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getprevious
jcl_getPrevious(JCL_HANDLE ch, JGP_LOCATION l, JGP_LOCATION *plres)
get the previous location associated with a location (i.e. where it came from) Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_getslots
jcl_getSlots(JCL_HANDLE ch, JGP_LOCATION l, int *pn)
Get the number of tape storage slots in the jukebox. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_import
jcl_import(JCL_HANDLE ch, JGP_LOCATION lport, JGP_LOCATION ldst )
import a tape into the jukebox and put it at ldst using the indicated port. We uncover the port, ask the user to tell us when the tape is in the port, and then cover it up and move the media to the destination location allocating an arm and waiting as neccesary Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_initloc
jcl_initloc( JCL_HANDLE ch, JGP_LOCATION loc )
Write an initial database entry for a given location; this should create a new entry if the database does not yet exist. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_listheader
jcl_listheader()
Print column headers for jcl_listloc() printf()'s them on stdout.
jcl_listjuke
jcl_listjuke()
lists all jukeboxes in our config file; open it, read config lines split them with jul_split, and print out the appropriate info. printf()'s them on stdout.
jcl_listloc
jcl_listloc(JCL_HANDLE ch, JGP_LOCATION l)
Print a one line listing for a location in the jukebox printf()'s it on stdout Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_load
jcl_load(JCL_HANDLE ch, JGP_LOCATION ldrv, JGP_LOCATION lsrc )
put a tape into a drive by using jsv_move allocating an arm and waiting as neccesary The media name associated with the slot is put on the drive instead if successful. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_nextempty
jcl_nextempty(JCL_HANDLE ch, JGP_LOCATION *pl )
Finds the next empty slot in the jukebox we can use (allocating an arm and waiting as neccesary), and then puts the location where pl points. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_offline
jcl_offline( JCL_HANDLE ch )
put the jukebox offline, just call jsv_offline Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_online
jcl_online( JCL_HANDLE ch )
put the jukebox online (just call jsv_online) Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_open
jcl_open(char *pcJuke, JCL_HANDLE *pch)
Open a jukebox by name; first find it in the config file, then call the server level open with the right types and pathnames. then read the permissions file with jcl_readperm Each config file line is read, if it starts with a # or ! is ignored otherwise it is split into fields in the array ppc[] fld meaning 0 jukebox name 1 jukebox host 2 permission file 3 jukebox type 4 jukebox device 5 lookup table type 6 lookup table pathname 7..n tape drive names separators are spaces, tabs, commas, and newlines. if the config line has a jukebox name matching our first argument, we do a jsv_open with the jukeobx type and device, and the lookup table type and pathname, then set the apcDrives array to point to the tape names, and scan the permission file. If any of this fails, we bail out. if we are on a UNIX system, we prepend the value of environment variable JUKE_DIR to the front of the config files and db file names. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_readperm
jcl_readperm(JSV_HANDLE sh, char *pcFile, int *pnOnline, int *pnInit )
Cruises through the permission file, set the appropriate permission ranges based on the access file permissions. Lines whose first character is # or ! are comments as usual, split the lines from the file up with jul_split to get fields, the fields are fld description 0 file name -- permissions on this file (readable, executable) are our permssions for these items 1 SLOT, DRIVE, PORT, ONLINE, or INIT -- says what sort of thing this line is settin permission for, INIT means we can initialize that database. 2 Low number of range of items 3 (Optional) High number of range of items, Low..High inclusive are given permssions matching our first fields in the filesystem Separators are spaces, tabs, and dashes. This routine is generally only ever called by jcl_open().
jcl_rename
jcl_rename(JCL_HANDLE ch, char *pcName, JGP_LOCATION l)
set the media name associated with the location. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_tape2loc
jcl_tape2loc(JCL_HANDLE ch, char *pcName, JGP_LOCATION *pl)
convert a string to a tape location; just use jsv_findname If there are multiple tapes with the same name, the match with the lowest nubmerd location is found. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)
jcl_unload
jcl_unload(JCL_HANDLE ch, JGP_LOCATION ldrv, JGP_LOCATION ldst )
take a tape out of a drive using jsv_move allocating an arm and waiting as neccesary The media name associated with the drive is put on the destination instead if successful. Return code can be checked with SUCCEEDED(n) or FAILED(n) and printed by err_print(n)