diff options
Diffstat (limited to 'pseudo_table.c')
-rw-r--r-- | pseudo_table.c | 250 |
1 files changed, 0 insertions, 250 deletions
diff --git a/pseudo_table.c b/pseudo_table.c deleted file mode 100644 index c890adc..0000000 --- a/pseudo_table.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * pseudo_table.c, data definitions and related utilities - * - * Copyright (c) 2008-2010 Wind River Systems, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Lesser GNU General Public License version 2.1 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Lesser GNU General Public License for more details. - * - * You should have received a copy of the Lesser GNU General Public License - * version 2.1 along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> - -#include "pseudo.h" -#include "pseudo_ipc.h" - -/* just a bunch of handy lookups for pretty-printing stuff */ - -static char *operation_names[] = { - "none", - "chdir", - "chmod", - "chown", - "chroot", - "close", - "creat", - "dup", - "fchmod", - "fchown", - "fstat", - "link", - "mkdir", - "mknod", - "open", - "rename", - "stat", - "unlink", - "symlink", - "exec", - "may-unlink", - "did-unlink", - "cancel-unlink", - NULL -}; - -static char *result_names[] = { - "none", - "succeed", - "fail", - "error", - NULL -}; - -static char *severity_names[] = { - "none", - "debug", - "info", - "warn", - "error", - "critical", - NULL -}; - -static char *query_type_names[] = { - "none", - "exact", - "less", - "greater", - "bitand", - "notequal", - "like", - "notlike", - "sqlpat", - NULL -}; - -static char *query_type_sql[] = { - "LITTLE BOBBY TABLES", - "=", - "<", - ">", - "&", - "!=", - "LIKE", - "NOT LIKE", - "LIKE", - NULL -}; - -static char *query_field_names[] = { - "zero", - "access", - "client", - "dev", - "fd", - "ftype", - "gid", - "id", - "ino", - "mode", - "op", - "order", - "path", - "perm", - "program", - "result", - "severity", - "stamp", - "tag", - "text", - "type", - "uid", - NULL -}; - -static char *pseudo_msg_type_names[] = { - "none", - "ping", - "halt", - "op", - "ack", - "nak", - NULL -}; - -char * -pseudo_op_name(op_id_t id) { - if (id >= OP_NONE && id < OP_MAX) { - return operation_names[id]; - } - return "unknown"; -} - -char * -pseudo_res_name(res_id_t id) { - if (id >= RESULT_NONE && id < RESULT_MAX) { - return result_names[id]; - } - return "unknown"; -} - -char * -pseudo_sev_name(sev_id_t id) { - if (id >= SEVERITY_NONE && id < SEVERITY_MAX) { - return severity_names[id]; - } - return "unknown"; -} - -char * -pseudo_query_type_name(pseudo_query_type_t id) { - if (id >= PSQT_NONE && id < PSQT_MAX) { - return query_type_names[id]; - } - return "unknown"; -} - -char * -pseudo_query_type_sql(pseudo_query_type_t id) { - if (id >= PSQT_NONE && id < PSQT_MAX) { - return query_type_sql[id]; - } - return "LITTLE BOBBY TABLES"; -} - -char * -pseudo_query_field_name(pseudo_query_field_t id) { - if (id >= PSQF_NONE && id < PSQF_MAX) { - return query_field_names[id]; - } - return "unknown"; -} - -char * -pseudo_msg_type_name(pseudo_msg_type_t id) { - if (id >= PSEUDO_MSG_NONE && id < PSEUDO_MSG_MAX) { - return pseudo_msg_type_names[id]; - } - return "????"; -} - -op_id_t -pseudo_op_id(char *name) { - int id; - for (id = OP_NONE; id < OP_MAX; ++id) { - if (!strcmp(name, operation_names[id])) - return id; - } - return OP_UNKNOWN; -} - -res_id_t -pseudo_res_id(char *name) { - int id; - for (id = RESULT_NONE; id < RESULT_MAX; ++id) { - if (!strcmp(name, result_names[id])) - return id; - } - return RESULT_UNKNOWN; -} - -sev_id_t -pseudo_sev_id(char *name) { - int id; - for (id = SEVERITY_NONE; id < SEVERITY_MAX; ++id) { - if (!strcmp(name, severity_names[id])) - return id; - } - return SEVERITY_UNKNOWN; -} - -pseudo_query_type_t -pseudo_query_type(char *name) { - int id; - for (id = PSQT_NONE; id < PSQT_MAX; ++id) { - if (!strcmp(name, query_type_names[id])) - return id; - } - return PSQT_UNKNOWN; -} - -pseudo_query_field_t -pseudo_query_field(char *name) { - int id; - for (id = PSQF_NONE; id < PSQF_MAX; ++id) { - if (!strcmp(name, query_field_names[id])) - return id; - } - return PSQF_UNKNOWN; -} - -pseudo_msg_type_t -pseudo_msg_type_id(char *name) { - int id; - for (id = PSEUDO_MSG_NONE; id < PSEUDO_MSG_MAX; ++id) { - if (!strcmp(name, pseudo_msg_type_names[id])) - return id; - } - return PSEUDO_MSG_NONE;; -} |