diff options
author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-01-20 10:24:37 +0000 |
---|---|---|
committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-01-20 10:24:37 +0000 |
commit | 9716a8f153707fdc317a52f4aa9f0dfa122f0cb6 (patch) | |
tree | ab22417f61d0e6dc5d883d228f2f3d27fbf6a10f /include | |
parent | 938eeba4af4a46126fc4d2fcbe46c15c98d70090 (diff) | |
download | zabbix-9716a8f153707fdc317a52f4aa9f0dfa122f0cb6.tar.gz zabbix-9716a8f153707fdc317a52f4aa9f0dfa122f0cb6.tar.xz zabbix-9716a8f153707fdc317a52f4aa9f0dfa122f0cb6.zip |
- new communication library and protocol (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@3733 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
-rw-r--r-- | include/comms.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/comms.h b/include/comms.h new file mode 100644 index 00000000..ec9647af --- /dev/null +++ b/include/comms.h @@ -0,0 +1,45 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program 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. +** +** 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 +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#ifndef ZABBIX_COMMS_H +#define ZABBIX_COMMS_H + +typedef enum +{ + ZBX_BUF_TYPE_STAT = 0, + ZBX_BUF_TYPE_DYN +} zbx_buf_type_t; + +typedef struct zbx_sock +{ + int socket; + char buf_stat[1024]; + char *buf_dyn; + zbx_buf_type_t buf_type; + char *error; +} zbx_sock_t; + +void zbx_tcp_init(zbx_sock_t *s); +int zbx_tcp_connect(zbx_sock_t *socket, char *ip, int port); +int zbx_tcp_send(zbx_sock_t *socket, char *data); +int zbx_tcp_recv(zbx_sock_t *socket, char **data); +void zbx_tcp_close(zbx_sock_t *socket); +void zbx_tcp_free(zbx_sock_t *socket); + +#endif |