Annotation of embedaddon/libpdel/ppp/ppp_fsm_option.h, revision 1.1
1.1 ! misho 1:
! 2: /*
! 3: * Copyright (c) 2001-2002 Packet Design, LLC.
! 4: * All rights reserved.
! 5: *
! 6: * Subject to the following obligations and disclaimer of warranty,
! 7: * use and redistribution of this software, in source or object code
! 8: * forms, with or without modifications are expressly permitted by
! 9: * Packet Design; provided, however, that:
! 10: *
! 11: * (i) Any and all reproductions of the source or object code
! 12: * must include the copyright notice above and the following
! 13: * disclaimer of warranties; and
! 14: * (ii) No rights are granted, in any manner or form, to use
! 15: * Packet Design trademarks, including the mark "PACKET DESIGN"
! 16: * on advertising, endorsements, or otherwise except as such
! 17: * appears in the above copyright notice or in the software.
! 18: *
! 19: * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
! 20: * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
! 21: * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
! 22: * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
! 23: * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
! 24: * OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
! 25: * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
! 26: * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
! 27: * RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE
! 28: * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
! 29: * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
! 30: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
! 31: * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
! 32: * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
! 33: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 34: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
! 35: * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
! 36: * THE POSSIBILITY OF SUCH DAMAGE.
! 37: *
! 38: * Author: Archie Cobbs <archie@freebsd.org>
! 39: */
! 40:
! 41: #ifndef _PDEL_PPP_PPP_FSM_OPTION_H_
! 42: #define _PDEL_PPP_PPP_FSM_OPTION_H_
! 43:
! 44: #ifndef _PDEL_PPP_PRIVATE_H_
! 45: #error "This header is only for use by the ppp library."
! 46: #endif
! 47:
! 48: struct ppp_log;
! 49: struct ppp_fsm_optdesc;
! 50:
! 51: /* One configuration option */
! 52: struct ppp_fsm_option {
! 53: u_char type;
! 54: u_char len;
! 55: u_char *data;
! 56: };
! 57:
! 58: /* A set of configuration options */
! 59: struct ppp_fsm_options {
! 60: u_int num;
! 61: struct ppp_fsm_option *opts;
! 62: };
! 63:
! 64: /* Option descriptors */
! 65: typedef void opt_pr_t(const struct ppp_fsm_optdesc *desc,
! 66: const struct ppp_fsm_option *opt,
! 67: char *buf, size_t bmax);
! 68:
! 69: struct ppp_fsm_optdesc {
! 70: const char *name; /* option name */
! 71: u_char type; /* option type value */
! 72: u_char min; /* option contents min valid length */
! 73: u_char max; /* option contents max valid length */
! 74: u_char supported; /* whether option is supported */
! 75: opt_pr_t *print; /* optional contents ascii decoder */
! 76: };
! 77:
! 78: __BEGIN_DECLS
! 79:
! 80: /* Built-in descriptor functions */
! 81: extern opt_pr_t ppp_fsm_pr_binary; /* show option as binary data */
! 82: extern opt_pr_t ppp_fsm_pr_hex32; /* show option as 32 bit hex number */
! 83: extern opt_pr_t ppp_fsm_pr_int16; /* show option as decimal u_int16_t */
! 84:
! 85: /* Functions */
! 86: extern struct ppp_fsm_options *ppp_fsm_option_create(void);
! 87: extern void ppp_fsm_option_destroy(struct ppp_fsm_options **optsp);
! 88: extern int ppp_fsm_option_add(struct ppp_fsm_options *opts, u_char type,
! 89: u_char len, const void *data);
! 90: extern int ppp_fsm_option_del(struct ppp_fsm_options *opts, u_int index);
! 91: extern void ppp_fsm_option_zero(struct ppp_fsm_options *opts);
! 92: extern struct ppp_fsm_options *ppp_fsm_option_copy(
! 93: struct ppp_fsm_options *opts);
! 94: extern int ppp_fsm_option_equal(const struct ppp_fsm_options *o1,
! 95: int i1, const struct ppp_fsm_options *o2, int i2);
! 96:
! 97: extern const struct ppp_fsm_optdesc *ppp_fsm_option_desc(
! 98: const struct ppp_fsm_optdesc *list,
! 99: const struct ppp_fsm_option *opt);
! 100: extern void ppp_fsm_options_decode(const struct ppp_fsm_optdesc *optlist,
! 101: const u_char *data, u_int len, char *buf, size_t bmax);
! 102:
! 103: extern struct ppp_fsm_options *ppp_fsm_option_unpack(const u_char *data,
! 104: u_int len);
! 105: extern u_int ppp_fsm_option_packlen(struct ppp_fsm_options *opts);
! 106: extern void ppp_fsm_option_pack(struct ppp_fsm_options *opts, u_char *buf);
! 107:
! 108: __END_DECLS
! 109:
! 110: #endif /* _PDEL_PPP_PPP_FSM_OPTION_H_ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>