int finit_db ( Dbptr db ) int map_autodrm_netsta ( char *anet, char *fsta, char *sta ); int map_seed_netsta ( char *snet, char *fsta, char *sta ); int map_autodrm_chanaux ( char *sta, char *fchan, char *aux, char *chan ); int map_seed_chanloc ( char *sta, char *fchan, char *loc, char *chan ); int autodrm_net ( char *sta, char *anet, char *fsta ); int seed_net ( char *sta, char *snet, char *fsta ); int autodrm_aux ( char *sta, char *chan, char *fchan, char *aux ); int seed_loc ( char *sta, char *chan, char *fchan, char *loc );
One method of dealing with this would be to modify the css3.0 schema to add net (and loc/aux) to every table where sta (and chan) are currently keys. However, this is a fairly high cost solution involving modifying all programs which reference these keys, and adding extra fields to the keys for a table would have a cost in execution speed also.
For many sites, this is only an occasional issue, warranting a less expensive solution: folding the network code into the station key, and the loc/aux code into the channel key, only when required. It's important that this happen in a well-defined manner, however. These routines address that issue.
These routines use one of the following tables: anetsta, snetsta, achanloc, or schanloc. Typically, a program initializes the database in which these tables should be found by calling finit_db; otherwise, a local foreignkeys database is used.
map_autodrm_netsta maps a net and station code from autodrm into a sta code for the local css3.0 database.
map_autodrm_chanaux maps a channel and aux code from autodrm into a chan code for a local css3.0 database; it also requires a local sta code.
autodrm_net and autodrm_aux perform the reverse mapping.
Similarly, map_seed_netsta maps a net and station code from seed into a sta code for the local css3.0 database.
map_seed_chanloc maps a channel and loc code from seed into a chan code for a local css3.0 database; it also requires a local sta code.
seed_net and seed_loc perform the reverse mapping.
When no match is found, the value returned is the input sta or chan name for the routines mapping foreign keys to local keys.
The routines mapping local keys to foreign keys return default values (taken from trdefaults.pf(5)) when no match is found.
When multiple matches are found, the values from one of the matching records is returned.
trdefaults(5) trmapnames(1)
There's no easy way to fill the various tables; they must be filled by hand.
The underlying tables do not allow for time dependencies in the mappings.