00001 /* 00002 * libkarmaclient - A C Library to the Karmasphere Reputation Server 00003 * Copyright (C) 2006 Karmasphere <http://www.karmasphere.com/> 00004 * - Shevek <shevek@karmasphere.com> 00005 * - Dave Stewart <dave.stewart@karmasphere.com> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 /* A note to porters and maintainers regarding sockets and I/O in 00023 * this library may be found in ks_socket_posix.c. */ 00024 00036 #ifndef INC_KS_SOCKET_H 00037 #define INC_KS_SOCKET_H 00038 00039 #include "ks_bquery.h" 00040 #include "ks_response.h" 00041 00042 #ifdef HAVE_SYS_TYPES_H 00043 #include <sys/types.h> 00044 #endif 00045 00046 #ifdef HAVE_SYS_SOCKET_H 00047 #include <sys/socket.h> 00048 #endif 00049 00053 typedef struct _ks_socket_t ks_socket_t; 00054 00055 ks_socket_t *ks_socket_new(const char *, const char *, int); 00056 int ks_socket_connect(ks_socket_t *); 00057 void ks_socket_close(ks_socket_t *); 00058 ssize_t ks_socket_send(ks_socket_t *, ks_bquery_t *); 00059 ks_response_t *ks_socket_recv(ks_socket_t *, ks_string_t *, int); 00060 ks_response_t *ks_socket_ask(ks_socket_t *, ks_bquery_t *, int); 00061 void ks_socket_free(ks_socket_t *); 00062 void ks_socket_set_auth(ks_socket_t *, const char *, const char *); 00063 00065 #define KS_TIMEOUT_DEFAULT 1000 00066 00067 #endif
1.5.1