Documentation
¶
Overview ¶
Package sip2 is a client for the 3M Standard Interchange Protocol version 2 (SIP2), the request/response protocol integrated library systems speak for real-time circulation. It implements the discovery slice: an optional Login (93/94) and Item Information (17/18) over a TCP session, for asking an ILS "is this item on the shelf?" It does not cover checkout, holds, fees or patron messages.
A session is strictly request/response and a Conn is not safe for concurrent use. The wire format is line-oriented: a two-digit command code, fixed-length fields, then pipe-delimited variable fields, terminated by a carriage return, with an optional trailing AY/AZ error-detection checksum.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CirculationStatusLabel ¶
CirculationStatusLabel returns the human-readable meaning of a SIP2 circulation status code, or "" for an unrecognized code.
Types ¶
type Client ¶
type Client struct {
Address string // host:port of the SIP2 server (the ACS)
// Login (93) is sent only when User is non-empty: CN=User, CO=Password, and
// CP=Location when set. Both algorithm bytes are the plain "0".
User string
Password string
Location string // login location code (CP); optional
// InstitutionID (AO) and TerminalPass (AC) ride on each Item Information
// request; both optional, sent as empty fields when unset.
InstitutionID string
TerminalPass string
// ErrorDetection appends the AY sequence and AZ checksum to each outbound
// message. Inbound AY/AZ are always tolerated and skipped regardless.
ErrorDetection bool
// Dial is the connection seam, overridable in tests. When nil a plain TCP
// dialer bound to the request context is used.
Dial func(ctx context.Context, addr string) (net.Conn, error)
}
Client holds the SIP2 target and session defaults. The zero value needs at least Address set; construct one with NewClient.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is one SIP2 session over a live connection. Not safe for concurrent use.
type ItemInfo ¶
type ItemInfo struct {
CirculationStatus string // 2-digit code, 01-13 (see CirculationStatusLabel)
StatusLabel string // human meaning of CirculationStatus
SecurityMarker string // 2-digit security marker
FeeType string // 2-digit fee type
TransactionDate string // 18-char SIP2 date
ItemID string // AB
Title string // AJ
DueDate string // AH
CurrentLocation string // AP
PermanentLocation string // AQ
CallNumber string // CS (3M extension)
HoldQueueLength string // CF
Fields map[string]string // all variable fields by 2-char code
}
ItemInfo is a parsed Item Information Response (18): the fixed status header and the variable fields a discovery caller reads. Fields holds every variable field (first occurrence) for anything not surfaced as a named member.