interface_util.h
1/*
2 * Player - One Hell of a Robot Server
3 * Copyright (C) 2000
4 * Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22/********************************************************************
23 *
24 * This library is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU Lesser General Public
26 * License as published by the Free Software Foundation; either
27 * version 2.1 of the License, or (at your option) any later version.
28 *
29 * This library is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 * Lesser General Public License for more details.
33 *
34 * You should have received a copy of the GNU Lesser General Public
35 * License along with this library; if not, write to the Free Software
36 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
37 *
38 ********************************************************************/
39
46#ifndef _INTERFACE_UTIL_H
47#define _INTERFACE_UTIL_H
48
49#if defined (WIN32)
50 #if defined (PLAYER_STATIC)
51 #define PLAYERINTERFACE_EXPORT
52 #elif defined (playerinterface_EXPORTS)
53 #define PLAYERINTERFACE_EXPORT __declspec (dllexport)
54 #else
55 #define PLAYERINTERFACE_EXPORT __declspec (dllimport)
56 #endif
57#else
58 #define PLAYERINTERFACE_EXPORT
59#endif
60
61#include <playerconfig.h> // for uint16_t type
62
63#ifdef __cplusplus
64extern "C" {
65#endif
71typedef struct
72{
73 uint16_t interf;
74 char* name;
76
80PLAYERINTERFACE_EXPORT int itable_init (void);
81
86PLAYERINTERFACE_EXPORT int itable_grow (int newSize);
87
91PLAYERINTERFACE_EXPORT void itable_destroy (void);
92
96PLAYERINTERFACE_EXPORT int itable_add (const char *name, unsigned int code, int replace);
97
103PLAYERINTERFACE_EXPORT int lookup_interface(const char* name, player_interface_t* interf);
104
110PLAYERINTERFACE_EXPORT int
111lookup_interface_code(int code, player_interface_t* interf);
112
118PLAYERINTERFACE_EXPORT const char*
119lookup_interface_name(unsigned int startpos, int code);
120
125PLAYERINTERFACE_EXPORT const char*
126interf_to_str(uint16_t code);
127
132PLAYERINTERFACE_EXPORT uint16_t
133str_to_interf(const char *name);
134
139PLAYERINTERFACE_EXPORT const char*
140msgtype_to_str(uint8_t code);
141
146PLAYERINTERFACE_EXPORT uint8_t
147str_to_msgtype(const char *name);
149#ifdef __cplusplus
150}
151#endif
152#endif
153
Available interfaces are stored in an array of these, defined in interface_util.c.
Definition interface_util.h:72