NCSA
emerge@ncsa.uiuc.edu

Gazelle Target API Reference

The Gazelle Target API contains a set of core routines which you implement to allow Gazelle to access a data source. It also contains utilities for constructing result records. Here's a summary of the routines in the Target API. For an overview of developing Target API implementations, look here.

The Core Routines


void *target_connect(Dict *params)

Description

Called when the client connects to Gazelle.

Parameters

Return Value

A "state pointer" containing any information the target implementation wants to keep track of between target API calls.


int target_search(const char *q, Dict *params, void *state)

Description

Called when the client issues a search request.

Parameters

Return Value

The number of records which matched the query.


target_record *target_present(long int ix, int bf, void *state)

Description

Called each time the client wishes to retrieve a record from the set of records which matched the query.

Parameters

Return Value

A target_record, which can be constructed from a null-terminated string or other character data using several utility functions for constructing target_records (see below).


int target_disconnect(void *state)

Description

Called when the client disconnects. Should clean up any resources associated with this client interaction and free the state pointer. Should return non-zero for success and zero for a fatal condition.

Parameters

Return Value

Nonzero if successful, zero if a fatal condition has arisen.


Target Record Constructors

These are used when returning records from target_present.


target_record *target_record_new(char *data, size_t len, char *syntax);

Description

Construct a target record from a given buffer in the given syntax.

Parameters

Return Value

A new target_record data structure.

target_record *target_record_newText(char *data, char *syntax);

Description

Construct a target record from a given null-terminated string in the given syntax.

Parameters

Return Value

A new target_record data structure.

target_record *target_record_newPlainText(char *data);

Description

Construct a target record from a given null-terminated string in plaintext syntax.

Parameters

Return Value

A new target_record data structure.