Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / lib / libtacplus / taclib.h
CommitLineData
984263bc
MD
1/*-
2 * Copyright (c) 1998, 2001, Juniper Networks, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: src/lib/libtacplus/taclib.h,v 1.1.1.1.6.1 2002/10/09 08:50:42 pst Exp $
1de703da 27 * $DragonFly: src/lib/libtacplus/taclib.h,v 1.2 2003/06/17 04:26:51 dillon Exp $
984263bc
MD
28 */
29
30#ifndef _TACLIB_H_
31#define _TACLIB_H_
32
33#include <sys/types.h>
34
35struct tac_handle;
36
37/* Flags for tac_add_server(). */
38#define TAC_SRVR_SINGLE_CONNECT 0x04 /* Keep connection open for multiple
39 sessions. */
40
41/* Disassembly of tac_send_authen() return value. */
42#define TAC_AUTHEN_STATUS(s) ((s) & 0xff)
43#define TAC_AUTHEN_NOECHO(s) ((s) & (1<<8))
44
45/* Disassembly of tac_send_author() return value. */
46#define TAC_AUTHOR_STATUS(s) ((s) & 0xff)
47#define TAC_AUTHEN_AV_COUNT(s) (((s)>>8) & 0xff)
48
49/* Privilege levels */
50#define TAC_PRIV_LVL_MIN 0x00
51#define TAC_PRIV_LVL_USER 0x01
52#define TAC_PRIV_LVL_ROOT 0x0f
53#define TAC_PRIV_LVL_MAX 0x0f
54
55/* Authentication actions */
56#define TAC_AUTHEN_LOGIN 0x01
57#define TAC_AUTHEN_CHPASS 0x02
58#define TAC_AUTHEN_SENDPASS 0x03
59#define TAC_AUTHEN_SENDAUTH 0x04
60
61/* Authentication types */
62#define TAC_AUTHEN_TYPE_ASCII 0x01
63#define TAC_AUTHEN_TYPE_PAP 0x02
64#define TAC_AUTHEN_TYPE_CHAP 0x03
65#define TAC_AUTHEN_TYPE_ARAP 0x04
66#define TAC_AUTHEN_TYPE_MSCHAP 0x05
67
68/* Authentication services */
69#define TAC_AUTHEN_SVC_NONE 0x00
70#define TAC_AUTHEN_SVC_LOGIN 0x01
71#define TAC_AUTHEN_SVC_ENABLE 0x02
72#define TAC_AUTHEN_SVC_PPP 0x03
73#define TAC_AUTHEN_SVC_ARAP 0x04
74#define TAC_AUTHEN_SVC_PT 0x05
75#define TAC_AUTHEN_SVC_RCMD 0x06
76#define TAC_AUTHEN_SVC_X25 0x07
77#define TAC_AUTHEN_SVC_NASI 0x08
78#define TAC_AUTHEN_SVC_FWPROXY 0x09
79
80/* Authentication reply status codes */
81#define TAC_AUTHEN_STATUS_PASS 0x01
82#define TAC_AUTHEN_STATUS_FAIL 0x02
83#define TAC_AUTHEN_STATUS_GETDATA 0x03
84#define TAC_AUTHEN_STATUS_GETUSER 0x04
85#define TAC_AUTHEN_STATUS_GETPASS 0x05
86#define TAC_AUTHEN_STATUS_RESTART 0x06
87#define TAC_AUTHEN_STATUS_ERROR 0x07
88#define TAC_AUTHEN_STATUS_FOLLOW 0x21
89
90/* Authorization authenticatication methods */
91#define TAC_AUTHEN_METH_NOT_SET 0x00
92#define TAC_AUTHEN_METH_NONE 0x01
93#define TAC_AUTHEN_METH_KRB5 0x02
94#define TAC_AUTHEN_METH_LINE 0x03
95#define TAC_AUTHEN_METH_ENABLE 0x04
96#define TAC_AUTHEN_METH_LOCAL 0x05
97#define TAC_AUTHEN_METH_TACACSPLUS 0x06
98#define TAC_AUTHEN_METH_RCMD 0x20
99/* If adding more, see comments in protocol_version() in taclib.c */
100
101/* Authorization status */
102#define TAC_AUTHOR_STATUS_PASS_ADD 0x01
103#define TAC_AUTHOR_STATUS_PASS_REPL 0x02
104#define TAC_AUTHOR_STATUS_FAIL 0x10
105#define TAC_AUTHOR_STATUS_ERROR 0x11
106
107__BEGIN_DECLS
108int tac_add_server(struct tac_handle *,
109 const char *, int, const char *, int, int);
110void tac_close(struct tac_handle *);
111int tac_config(struct tac_handle *, const char *);
112int tac_create_authen(struct tac_handle *, int, int, int);
113void *tac_get_data(struct tac_handle *, size_t *);
114char *tac_get_msg(struct tac_handle *);
115struct tac_handle *tac_open(void);
116int tac_send_authen(struct tac_handle *);
117int tac_set_data(struct tac_handle *,
118 const void *, size_t);
119int tac_set_msg(struct tac_handle *, const char *);
120int tac_set_port(struct tac_handle *, const char *);
121int tac_set_priv(struct tac_handle *, int);
122int tac_set_rem_addr(struct tac_handle *, const char *);
123int tac_set_user(struct tac_handle *, const char *);
124const char *tac_strerror(struct tac_handle *);
125int tac_send_author(struct tac_handle *);
126int tac_create_author(struct tac_handle *, int, int, int);
127int tac_set_av(struct tac_handle *, u_int, const char *);
128char *tac_get_av(struct tac_handle *, u_int);
129char *tac_get_av_value(struct tac_handle *, const char *);
130void tac_clear_avs(struct tac_handle *);
131__END_DECLS
132
133#endif /* _TACLIB_H_ */