libtsnet.h revision 909c1a3310e6a348a85950c7179fefda50d0e37d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* All symbols and functions in this header file and library are private to Sun
* Microsystems. The only guarantee that is made is that if your application
* uses them, it will break on upgrade.
*/
#ifndef _LIBTSNET_H
#define _LIBTSNET_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TNRHTP_PATH "/etc/security/tsol/tnrhtp"
#define TNRHDB_PATH "/etc/security/tsol/tnrhdb"
#define TNZONECFG_PATH "/etc/security/tsol/tnzonecfg"
#define TNDB_COMMA ", \t"
#define TN_RESERVED ",#;"
/*
* String parsing routines
*
* These functions are in four logical groups: one for template (tnrhtp)
* entries, one for remote host (tnrhdb) entries, one for zone configuration
* (tnzonecfg) entries, and a fourth for routing attributes.
*
* In each group, there are functions that parse from a string or database, and
* a function to free returned entries. The parsing functions all take a
* pointer to an integer and a pointer to a character pointer for returning
* errors. On error, the returned entry pointer is NULL, the integer is set to
* one of the LTSNET_* errors below, and the character pointer points to the
* location of the error. (For the functions that iterate on a database, this
* points into static storage in the library. This storage is associated with
* the iterator.)
*
* The functions that do look-ups based on a value (name or address) do not
* return errors other than "not found," which is signaled by a return value of
* NULL.
*/
/* Template entry parsing */
extern tsol_tpent_t *tsol_gettpbyname(const char *);
extern tsol_tpent_t *tsol_gettpent(void);
extern void tsol_freetpent(tsol_tpent_t *);
extern void tsol_settpent(int);
extern void tsol_endtpent(void);
extern int str_to_tpstr(const char *, int, void *, char *, int);
/* Remote host entry parsing */
extern tsol_rhent_t *tsol_getrhent(void);
extern void tsol_freerhent(tsol_rhent_t *);
extern void tsol_setrhent(int);
extern void tsol_endrhent(void);
extern int str_to_rhstr(const char *, int, void *, char *, int);
extern tsol_host_type_t tsol_getrhtype(char *);
/* Zone configuration parsing */
extern tsol_zcent_t *tsol_sgetzcent(const char *, int *, char **);
extern void tsol_freezcent(tsol_zcent_t *);
/* Routing attribute parsing */
struct rtsa_s;
extern const char *parse_entry(char *, size_t, const char *, const char *);
/* Convert LTSNET_* to a printable string */
extern const char *tsol_strerror(int, int);
/* System calls; these return -1 on error and set errno */
extern int tnrhtp(int, tsol_tpent_t *);
extern int tnrh(int, tsol_rhent_t *);
extern int tnmlp(int, tsol_mlpent_t *);
/*
* Errors that can occur in the parsing routines. Note that not all errors are
* possible with every routine. Must be kept in sync with list in misc.c.
*/
#define LTSNET_NONE 0 /* No error */
#ifdef __cplusplus
}
#endif
#endif /* _LIBTSNET_H */