1121934Sharti/* 2121934Sharti * Copyright (c) 2001-2003 3121934Sharti * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4121934Sharti * All rights reserved. 5121934Sharti * 6121934Sharti * Redistribution and use in source and binary forms, with or without 7121934Sharti * modification, are permitted provided that the following conditions 8121934Sharti * are met: 9121934Sharti * 1. Redistributions of source code must retain the above copyright 10121934Sharti * notice, this list of conditions and the following disclaimer. 11121934Sharti * 2. Redistributions in binary form must reproduce the above copyright 12121934Sharti * notice, this list of conditions and the following disclaimer in the 13121934Sharti * documentation and/or other materials provided with the distribution. 14121934Sharti * 15121934Sharti * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16121934Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17121934Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18121934Sharti * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19121934Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20121934Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21121934Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22121934Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23121934Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24121934Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25121934Sharti * SUCH DAMAGE. 26121934Sharti * 27121934Sharti * Author: Hartmut Brandt <harti@freebsd.org> 28121934Sharti * 29131826Sharti * $Begemot: libunimsg/netnatm/msg/uniprint.h,v 1.4 2004/07/08 08:22:08 brandt Exp $ 30121934Sharti * 31121934Sharti * Print utility functions. These are only needed if you want to hook to 32121934Sharti * the format of the uni printing routines. 33121934Sharti */ 34121934Sharti#ifndef _NETNATM_MSG_UNIPRINT_H_ 35121934Sharti#define _NETNATM_MSG_UNIPRINT_H_ 36121934Sharti 37121934Sharti#include <netnatm/msg/uni_config.h> 38121934Sharti 39121934Sharti/* 40121934Sharti * This structure is used to define value->string mappings. 41121934Sharti * It must be terminated by a { NULL, 0 } entry. 42121934Sharti */ 43121934Shartistruct uni_print_tbl { 44121934Sharti const char *name; 45121934Sharti u_int val; 46121934Sharti}; 47121934Shartivoid uni_print_tbl(const char *_entry, u_int _val, 48121934Sharti const struct uni_print_tbl *_tbl, struct unicx *_cx); 49121934Sharti 50121934Sharti/* initialize printing. This must be called at the start from each external 51121934Sharti * callable printing function. */ 52121934Shartivoid uni_print_init(char *_buf, size_t _bufsiz, struct unicx *_cx); 53121934Sharti 54121934Sharti/* End the current (semantical) line. This takes care of indendation and 55121934Sharti * actually print the newline in the appropriate modes. */ 56121934Shartivoid uni_print_eol(struct unicx *_cx); 57121934Sharti 58121934Sharti/* Push or pop a prefix. This takes care of indendation. */ 59121934Shartivoid uni_print_push_prefix(const char *_prefix, struct unicx *_cx); 60121934Shartivoid uni_print_pop_prefix(struct unicx *_cx); 61121934Sharti 62121934Sharti/* Print a flag taking care of the right prefixing */ 63121934Shartivoid uni_print_flag(const char *_flag, struct unicx *_cx); 64121934Sharti 65121934Sharti/* Print an entry taking care of the right prefixing */ 66121934Shartivoid uni_print_entry(struct unicx *_cx, const char *_entry, 67121934Sharti const char *_fmt, ...) __printflike(3, 4); 68121934Sharti 69121934Sharti/* Generic printf */ 70121934Shartivoid uni_printf(struct unicx *_cx, const char *_fmt, ...) __printflike(2, 3); 71121934Sharti 72121934Sharti#endif 73