1 2 /* $Header: /cvsroot/faces/faces/faces/face_socket.h,v 1.1.1.1 2002/04/15 20:20:48 richburridge Exp $ 3 * 4 * This module is a massivily modified version of mutt_socket.c 5 * found in the mutt mailreader. The origional copyrights read: 6 * 7 * Copyright (C) 1998 Brandon Long <blong@fiction.net> 8 * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com> 9 * 10 * Mutt is distributed under the FSF GNU General Public Licence. The 11 * Mutt program itself can be found at http://www.mutt.org/. 12 * 13 * This version is 14 * Copyright (C) 2001-2002 Robert Adams (misterblue@misterblue.com) 15 * All rights reserved. 16 * 17 * Permission is given to distribute these sources, as long as the 18 * copyright messages are not removed, and no monies are exchanged. 19 * 20 * No responsibility is taken for any errors on inaccuracies inherent 21 * either to the comments or the code of this program, but if reported 22 * to me, then an attempt will be made to fix them. 23 * 24 */ 25 26 #ifndef _FACE_SOCKET_H_ 27 #define _FACE_SOCKET_H_ 1 28 29 /* logging levels */ 30 #define M_SOCK_LOG_CMD 2 31 #define M_SOCK_LOG_HDR 3 32 #define M_SOCK_LOG_FULL 4 33 34 #ifndef LONG_STRING 35 #define LONG_STRING 1024 36 #endif 37 38 typedef struct _connection { 39 char inbuf[LONG_STRING]; 40 int bufpos; 41 int available; 42 43 int fd; 44 45 char *host; 46 int port; 47 int (*read) (struct _connection *conn, char *buf, size_t len); 48 int (*write) (struct _connection *conn, const char *buf, size_t count); 49 int (*open) (struct _connection *conn); 50 int (*close) (struct _connection *conn); 51 } CONNECTION; 52 53 CONNECTION* build_connection(char*, int); 54 int free_connection(CONNECTION *); 55 56 int face_socket_readchar(CONNECTION *, char*); 57 int face_socket_readln(CONNECTION *, char*, size_t); 58 59 int face_socket_open(CONNECTION *); 60 int face_socket_close(CONNECTION *); 61 int face_socket_read(CONNECTION *, char *, size_t); 62 int face_socket_readchar(CONNECTION *, char *); 63 int face_socket_write(CONNECTION *, const char *, int); 64 65 int raw_socket_read(CONNECTION*, char *, size_t); 66 int raw_socket_write(CONNECTION*, const char *, size_t); 67 int raw_socket_open(CONNECTION *); 68 int raw_socket_close(CONNECTION *); 69 70 #endif /*_FACE_SOCKET_H_*/ 71