/*
 * ----------------------------------------------------------------
 * Night Light IRC Proxy - Ident Daemon - Connection Header
 * ----------------------------------------------------------------
 * Copyright (C) 1997-2006 Jonas Kvinge <jonas@night-light.net>
 * All rights reserved.
 *
 * 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.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Last modified by:
 * Jonas Kvinge (04.07.2003)
 *
 */

#ifdef IDENT_CONN_H
#warning "ident_conn.h already included."
#else
#define IDENT_CONN_H

/* DEFINES - JONAS (04.07.2003) */

#define IDENTCONN_TIMEOUT			45

/* BIT MASKS - JONAS (04.07.2003) */

#define IDENTCONN_SOCKET			1

/* MACROS - JONAS (04.07.2003) */

#define IdentConn_SetSocket(x)			((x)->Flags |= IDENTCONN_SOCKET)
#define IdentConn_ClearSocket(x)		((x)->Flags &= ~IDENTCONN_SOCKET)
#define IdentConn_IsSocket(x)			((x)->Flags & IDENTCONN_SOCKET)

/* STRUCTURES - JONAS (04.07.2003) */

struct IdentConn_Struct {

  unsigned long int Flags;

  char *HostIPS;

  struct in_addr INAddr;
#if IPV6_SUPPORT
  struct in6_addr INAddr6;
#endif

  unsigned long int PortH;
  unsigned long int PortN;

  signed long int FD;

  char *RecvBuffer;
  char *SendBuffer;

  time_t Time;

  struct IdentConn_Struct *Prev;
  struct IdentConn_Struct *Next;

};

/* FUNCTION PROTOTYPES - JONAS (04.07.2003) */

struct IdentConn_Struct *ident_conn_add(const char *const HostIPSPT, signed long int FD);
void ident_conn_rem(struct IdentConn_Struct *IdentConnS);
void ident_conn_initconnection(struct IdentConn_Struct *IdentConnS);
void ident_conn_disconnect(struct IdentConn_Struct *IdentConnS);
void ident_conn_fds(fd_set *ReadFDS, fd_set *WriteFDS, unsigned long int *FDS);
void ident_conn_io(fd_set *ReadFDS, fd_set *WriteFDS, unsigned long int *FDS);
void ident_conn_recv(struct IdentConn_Struct *IdentConnS);
void ident_conn_send(struct IdentConn_Struct *IdentConnS);
void ident_conn_addsend(struct IdentConn_Struct *IdentConnS, const char *const LinePT, ...) __attribute__ ((format (printf, 2, 3)));
void ident_conn_parse(struct IdentConn_Struct *IdentConnS);
void ident_conn_parse_message(struct IdentConn_Struct *IdentConnS, char *MessagePT);
unsigned short int ident_conn_closeall(void);

#endif


syntax highlighted by Code2HTML, v. 0.9.1