1c5c4113dSnw141292 /* 2c5c4113dSnw141292 * CDDL HEADER START 3c5c4113dSnw141292 * 4c5c4113dSnw141292 * The contents of this file are subject to the terms of the 5c5c4113dSnw141292 * Common Development and Distribution License (the "License"). 6c5c4113dSnw141292 * You may not use this file except in compliance with the License. 7c5c4113dSnw141292 * 8c5c4113dSnw141292 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9c5c4113dSnw141292 * or http://www.opensolaris.org/os/licensing. 10c5c4113dSnw141292 * See the License for the specific language governing permissions 11c5c4113dSnw141292 * and limitations under the License. 12c5c4113dSnw141292 * 13c5c4113dSnw141292 * When distributing Covered Code, include this CDDL HEADER in each 14c5c4113dSnw141292 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15c5c4113dSnw141292 * If applicable, add the following below this CDDL HEADER, with the 16c5c4113dSnw141292 * fields enclosed by brackets "[]" replaced with your own identifying 17c5c4113dSnw141292 * information: Portions Copyright [yyyy] [name of copyright owner] 18c5c4113dSnw141292 * 19c5c4113dSnw141292 * CDDL HEADER END 20c5c4113dSnw141292 */ 21c5c4113dSnw141292 /* 22c5c4113dSnw141292 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23c5c4113dSnw141292 * Use is subject to license terms. 24c5c4113dSnw141292 */ 25c5c4113dSnw141292 26c5c4113dSnw141292 27c5c4113dSnw141292 #ifndef _IDMAP_ENGINE_H 28c5c4113dSnw141292 #define _IDMAP_ENGINE_H 29c5c4113dSnw141292 30c5c4113dSnw141292 /* Debug macros */ 31c5c4113dSnw141292 #define DPTR(a) printf("%s::%d %s = %p\n", __FILE__, __LINE__, #a, a); 32c5c4113dSnw141292 #define DSTRING(a) printf("%s::%d %s = \"%s\"\n", __FILE__, __LINE__, #a, \ 33c5c4113dSnw141292 a ? a : "(null)"); 34c5c4113dSnw141292 #define DINT(a) printf("%s::%d %s = %d\n", __FILE__, __LINE__, #a, a); 35c5c4113dSnw141292 #define DHEX(a) printf("%s::%d %s = %X\n", __FILE__, __LINE__, #a, a); 36c5c4113dSnw141292 37c5c4113dSnw141292 #ifdef __cplusplus 38c5c4113dSnw141292 extern "C" { 39c5c4113dSnw141292 #endif 40c5c4113dSnw141292 41c5c4113dSnw141292 typedef char *flag_t; 42c5c4113dSnw141292 #define FLAG_SET (char *)1 43c5c4113dSnw141292 #define FLAG_ALPHABET_SIZE 255 44c5c4113dSnw141292 45c5c4113dSnw141292 #define IDMAP_ENG_OK 0 46c5c4113dSnw141292 #define IDMAP_ENG_ERROR -1 47c5c4113dSnw141292 #define IDMAP_ENG_ERROR_SILENT -2 48c5c4113dSnw141292 49*8e228215Sdm199847 typedef struct cmd_pos { 50*8e228215Sdm199847 int linenum; /* line number */ 51*8e228215Sdm199847 char *line; /* line content */ 52*8e228215Sdm199847 } cmd_pos_t; 53*8e228215Sdm199847 54*8e228215Sdm199847 55c5c4113dSnw141292 typedef struct cmd_ops { 56c5c4113dSnw141292 const char *cmd; /* the subcommand */ 57c5c4113dSnw141292 const char *options; /* getopt string for the subcommand params */ 58*8e228215Sdm199847 int (*p_do_func)(flag_t *f, 59*8e228215Sdm199847 int argc, 60*8e228215Sdm199847 char **argv, 61*8e228215Sdm199847 cmd_pos_t *pos); /* handle */ 62c5c4113dSnw141292 } cmd_ops_t; 63c5c4113dSnw141292 64c5c4113dSnw141292 extern int engine_init(int comc, cmd_ops_t *comv, int argc, char **argv, 65c5c4113dSnw141292 int *is_batch_mode); 66c5c4113dSnw141292 extern int engine_fini(); 67c5c4113dSnw141292 68c5c4113dSnw141292 extern int run_engine(int argc, char **argv); 69c5c4113dSnw141292 70c5c4113dSnw141292 #ifdef __cplusplus 71c5c4113dSnw141292 } 72c5c4113dSnw141292 #endif 73c5c4113dSnw141292 74c5c4113dSnw141292 #endif /* _IDMAP_ENGINE_H */ 75