summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/glibtop/command.h102
-rw-r--r--include/glibtop/gnuserv.h161
-rw-r--r--include/glibtop/read.h39
-rw-r--r--include/glibtop/read_data.h39
-rw-r--r--include/glibtop/version.h42
-rw-r--r--include/glibtop/write.h39
6 files changed, 422 insertions, 0 deletions
diff --git a/include/glibtop/command.h b/include/glibtop/command.h
new file mode 100644
index 00000000..02eced03
--- /dev/null
+++ b/include/glibtop/command.h
@@ -0,0 +1,102 @@
+/* $Id$ */
+
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop 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 GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __GLIBTOP_COMMAND_H__
+#define __GLIBTOP_COMMAND_H__
+
+#include <glibtop.h>
+#include <glibtop/sysdeps.h>
+#include <glibtop/union.h>
+
+BEGIN_LIBGTOP_DECLS
+
+#define GLIBTOP_CMND_QUIT 0
+#define GLIBTOP_CMND_SYSDEPS 1
+
+#define GLIBTOP_CMND_CPU 2
+#define GLIBTOP_CMND_MEM 3
+#define GLIBTOP_CMND_SWAP 4
+#define GLIBTOP_CMND_UPTIME 5
+#define GLIBTOP_CMND_LOADAVG 6
+#define GLIBTOP_CMND_SHM_LIMITS 7
+#define GLIBTOP_CMND_MSG_LIMITS 8
+#define GLIBTOP_CMND_SEM_LIMITS 9
+#define GLIBTOP_CMND_PROCLIST 10
+
+#define GLIBTOP_CMND_PROC_STATE 11
+#define GLIBTOP_CMND_PROC_UID 12
+#define GLIBTOP_CMND_PROC_MEM 13
+#define GLIBTOP_CMND_PROC_TIME 14
+#define GLIBTOP_CMND_PROC_SIGNAL 15
+#define GLIBTOP_CMND_PROC_KERNEL 16
+#define GLIBTOP_CMND_PROC_SEGMENT 17
+#define GLIBTOP_CMND_PROC_ARGS 18
+#define GLIBTOP_CMND_PROC_MAP 19
+
+#define GLIBTOP_CMND_MOUNTLIST 20
+#define GLIBTOP_CMND_FSUSAGE 21
+#define GLIBTOP_CMND_NETLOAD 22
+#define GLIBTOP_CMND_PPP 23
+
+#define GLIBTOP_MAX_CMND 24
+
+#define _GLIBTOP_PARAM_SIZE 16
+
+typedef struct _glibtop_command glibtop_command;
+
+typedef struct _glibtop_response glibtop_response;
+typedef union _glibtop_response_union glibtop_response_union;
+
+struct _glibtop_command
+{
+ u_int64_t command;
+ u_int64_t size, data_size;
+ char parameter [_GLIBTOP_PARAM_SIZE];
+};
+
+union _glibtop_response_union
+{
+ glibtop_union data;
+ glibtop_sysdeps sysdeps;
+};
+
+struct _glibtop_response
+{
+ int64_t offset;
+ u_int64_t size, data_size;
+ glibtop_response_union u;
+};
+
+#define glibtop_call(p1, p2, p3, p4) glibtop_call_r(glibtop_global_server, p1, p2, p3, p4)
+
+void *
+glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
+ const void *send_buf, size_t recv_size, void *recv_buf);
+
+void *
+glibtop_call_s (glibtop *server, unsigned command, size_t send_size,
+ const void *send_buf, size_t recv_size, void *recv_buf);
+
+END_LIBGTOP_DECLS
+
+#endif
diff --git a/include/glibtop/gnuserv.h b/include/glibtop/gnuserv.h
new file mode 100644
index 00000000..6f945c71
--- /dev/null
+++ b/include/glibtop/gnuserv.h
@@ -0,0 +1,161 @@
+/* -*-C-*-
+
+ Header file for the GNU Emacs server and client C code.
+
+ This file is part of GNU Emacs.
+
+ Copying is permitted under those conditions described by the GNU
+ General Public License.
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+
+ Author: Andy Norman (ange@hplb.hpl.hp.com), based on
+ 'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
+ Emacs distribution.
+
+ Please mail bugs and suggestions to the author at the above address.
+*/
+
+/* HISTORY
+ * 11-Nov-1990 bristor@simba
+ * Added EOT stuff.
+ */
+
+/*
+ * This file incorporates new features added by Bob Weiner <weiner@mot.com>,
+ * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
+ * Please see the note at the end of the README file for details.
+ *
+ * (If gnuserv came bundled with your emacs, the README file is probably
+ * ../etc/gnuserv.README relative to the directory containing this file)
+ */
+
+#if 0
+static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup alpha !";
+#endif
+
+#define NO_SHORTNAMES
+
+#define PATCHLEVEL 2
+
+#define NO_SHORTNAMES
+/* gnuserv should not be compiled using SOCKS */
+#define DO_NOT_SOCKSIFY
+#include <glibtop.h>
+#include <glibtop/error.h>
+#undef read
+#undef write
+#undef open
+#undef close
+#undef signal
+
+/* Define the communication method between server and clients:
+ * You can have either or both kinds of sockets, but you can't mix
+ * sockets with sysv ipc
+ */
+
+#define INTERNET_DOMAIN_SOCKETS
+#define UNIX_DOMAIN_SOCKETS
+
+/*
+ * Define additional authentication protocols to be used. These methods will
+ * be tried before falling back to the default gnuserv protocol (based on
+ * the GNU_SECURE environment variable). Currently, only MIT-MAGIC-COOKIE-1
+ * is also supported.
+ *
+ * Comment out the next line(s) if you don't want to enable the
+ * appropriate authentication protocol.
+ */
+
+#if defined (HAVE_XAUTH)
+#define AUTH_MAGIC_COOKIE
+#endif /* HAVE_XAUTH */
+
+/*
+ * stuff related to supporting MIT-MAGIC-COOKIE-1
+ */
+
+#if 0
+#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
+#endif
+#define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
+#define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
+
+
+#define DEFAUTH_NAME "GNU-SECURE" /* name of default auth protocol */
+#define AUTH_TIMEOUT 15 /* # seconds to wait for auth data */
+#define AUTH_NAMESZ 15 /* max allows auth protocol name size */
+
+
+/*
+ * Pick a default communication scheme, if none was specified.
+ */
+
+#if !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
+
+/* BSD systems use Unix Domain sockets by default */
+
+#ifdef BSD
+#define UNIX_DOMAIN_SOCKETS
+#endif
+
+#endif /* No communication method pre-defined */
+
+/*
+ * If you are using SYSV_IPC, you might want to make the buffer size bigger
+ * since it limits the size of requests and responses. Don't make it bigger
+ * than your system's max message size though (usually a couple of k) or else
+ * msgsend will start failing. For sockets, using the system BUFSIZ is usually
+ * what you want.
+ */
+
+#if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
+#include <sys/socket.h>
+#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
+
+#ifdef INTERNET_DOMAIN_SOCKETS
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#define TABLE_SIZE 101 /* The number of entries in the hash table */
+#define HASH(host) host /* Rather simplistic hash function */
+#define DEFAULT_PORT 21490 /* default port number to use is
+ * DEFAULT_PORT + uid */
+#endif /* INTERNET_DOMAIN_SOCKETS */
+
+#ifdef UNIX_DOMAIN_SOCKETS
+#include <sys/un.h>
+#define HIDE_UNIX_SOCKET /* put the unix socket in a protected dir */
+#endif /* UNIX_DOMAIN_SOCKETS */
+
+#define HOSTNAMSZ 255 /* max size of a hostname */
+#define REPLYSIZ 300 /* max size of reply from server to client */
+#undef FALSE
+#define FALSE 0
+#undef TRUE
+#define TRUE 1
+
+/* The casts shut Sun's compiler up and are safe in the context these
+ are actually used. */
+#define max2(x,y) (((int) (x) > (int) (y)) ? (x) : (y))
+#define min2(x,y) (((int) (x) < (int) (y)) ? (x) : (y))
+
+#ifndef _NFILE /* rough guess at maximum number of open files */
+#define _NFILE 20
+#endif
+
+#define EOT_STR "\004"
+#define EOT_CHR '\004'
+
+/* connection types */
+#define CONN_UNIX 0
+#define CONN_INTERNET 1
+#define CONN_IPC 2
+
+/* function declarations */
+int glibtop_make_connection (const char *hostarg, int portarg, int *s);
+
+#ifdef INTERNET_DOMAIN_SOCKETS
+long glibtop_internet_addr (const char *host);
+#endif
+
diff --git a/include/glibtop/read.h b/include/glibtop/read.h
new file mode 100644
index 00000000..e4862ba6
--- /dev/null
+++ b/include/glibtop/read.h
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop 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 GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __GLIBTOP_READ_H__
+#define __GLIBTOP_READ_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+BEGIN_LIBGTOP_DECLS
+
+#define glibtop_read(p1, p2) glibtop_read(glibtop_global_server, p1, p2)
+
+void glibtop_read_l (glibtop *server, size_t size, void *buf);
+void glibtop_read_s (glibtop *server, size_t size, void *buf);
+
+END_LIBGTOP_DECLS
+
+#endif
diff --git a/include/glibtop/read_data.h b/include/glibtop/read_data.h
new file mode 100644
index 00000000..07bfec05
--- /dev/null
+++ b/include/glibtop/read_data.h
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop 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 GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __GLIBTOP_READ_DATA_H__
+#define __GLIBTOP_READ_DATA_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+BEGIN_LIBGTOP_DECLS
+
+#define glibtop_read_data() glibtop_read_data_r(glibtop_global_server)
+
+void *glibtop_read_data_l (glibtop *server);
+void *glibtop_read_data_s (glibtop *server);
+
+END_LIBGTOP_DECLS
+
+#endif
diff --git a/include/glibtop/version.h b/include/glibtop/version.h
new file mode 100644
index 00000000..92354833
--- /dev/null
+++ b/include/glibtop/version.h
@@ -0,0 +1,42 @@
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop 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 GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __GLIBTOP_VERSION_H__
+#define __GLIBTOP_VERSION_H__
+
+#include <glibtop.h>
+#include <glibtop/union.h>
+#include <glibtop/sysdeps.h>
+#include <glibtop/command.h>
+
+#define LIBGTOP_VERSION_STRING "Libgtop %s server version %s (%u,%u,%u,%u)."
+
+BEGIN_LIBGTOP_DECLS
+
+#if _IN_LIBGTOP
+
+void glibtop_send_version (glibtop *server, int fd);
+
+#endif
+
+END_LIBGTOP_DECLS
+
+#endif
diff --git a/include/glibtop/write.h b/include/glibtop/write.h
new file mode 100644
index 00000000..bff8d4e7
--- /dev/null
+++ b/include/glibtop/write.h
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop 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 GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __GLIBTOP_WRITE_H__
+#define __GLIBTOP_WRITE_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+BEGIN_LIBGTOP_DECLS
+
+#define glibtop_write(p1, p2) glibtop_write(glibtop_global_server, p1, p2)
+
+void glibtop_write_l (glibtop *server, size_t size, void *buf);
+void glibtop_write_s (glibtop *server, size_t size, void *buf);
+
+END_LIBGTOP_DECLS
+
+#endif