FreeWRL / FreeX3D 4.3.0
plugin_utils.h
1/*
2 * FreeWRL plugin
3 *
4 * To communicate with FreeWRL, we define structures and protocol.
5 *
6 */
7
8/****************************************************************************
9 This file is part of the FreeWRL/FreeX3D Distribution.
10
11 Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
12
13 FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
14 it under the terms of the GNU Lesser Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 FreeWRL/FreeX3D is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
25****************************************************************************/
26
27
28#ifndef __FREEWRL_PLUGIN_UTILS_H__
29#define __FREEWRL_PLUGIN_UTILS_H__
30
31
32/* JAS
33#ifndef _DEBUG
34#define _DEBUG 0
35#endif
36*/
37
38#define SMALLSTRINGSIZE 64
39#define STRINGSIZE 128
40#define LARGESTRINGSIZE 256
41
42#define PLUGIN_PORT 2009
43#define PLUGIN_TIMEOUT_SEC 10
44#define PLUGIN_TIMEOUT_NSEC 0
45
46#define PLUGIN_RETRY 2
47#define SLEEP_TIME 5
48
49#define NO_ERROR 0
50#define SOCKET_ERROR -1000
51#define SIGNAL_ERROR -1001
52
53#define UNUSED(v) ((void) v)
54
55typedef struct _urlRequest {
56 char url[FILENAME_MAX]; /* limit url length (defined in stdio.h) */
57 void *instance; /* NPP instance for plugin */
58 unsigned int notifyCode; /* NPN_GetURLNotify, NPP_URLNotify */
60
61/* const char* XEventToString(int type); */
62/* const char* XErrorToString(int error); */
63
64void URLencod (char *dest, const char *src, int maxlen);
65
66/* for reporting version info -- this function is defined in "internal_version.c" */
67const char *freewrl_plugin_get_version(void);
68
69#endif /* __FREEWRL_PLUGIN_UTILS_H__ */