ident.h

musicmud-2.1.6/include/ident.h · 1.6 KB

From the archive musicmud2.1.6.tar.gz

Download the archive   « Back to the archive contents

/*
** ident.h
**
** Author: Peter Eriksson <pen@lysator.liu.se>
** Intruder: Pär Emanuelsson <pell@lysator.liu.se>
*/

#ifndef IDENT_H__
#define IDENT_H__

#ifdef	__cplusplus
extern "C" {
#endif

#include <sys/types.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <sys/socket.h>

#ifndef IDBUFSIZE
#  define IDBUFSIZE 2048
#endif

#ifndef IDPORT
#  define IDPORT	113
#endif

typedef struct
{
  int fd;
  char buf[IDBUFSIZE];
} ident_t;

typedef struct {
  int lport;                    /* Local port */
  int fport;                    /* Far (remote) port */
  char *identifier;             /* Normally user name */
  char *opsys;                  /* OS */
  char *charset;                /* Charset (what did you expect?) */
} IDENT;                        /* For higher-level routines */

/* Low-level calls and macros */
#define id_fileno(ID)	((ID)->fd)

ident_t *id_open(struct in_addr *, struct in_addr *, struct timeval *);
  
extern int id_close (ident_t *id);
  
extern int id_query(ident_t *, int, int, struct timeval *);
  
extern int id_parse (ident_t *id,
		     struct timeval * timeout,
		     int *lport,
		     int *fport,
		     char **identifier,
		     char **opsys,
		     char **charset);
  
/* High-level calls */

extern IDENT *ident_lookup (int fd, int timeout);

extern char  *ident_id (int fd, int timeout);

extern IDENT *ident_query ( struct in_addr * laddr, struct in_addr * raddr, int lport, int rport, int timeout);

extern void   ident_free (IDENT *id);

extern char  id_version[];

#ifdef IN_LIBIDENT_SRC

extern char *id_strdup (char *str);
extern char *id_strtok (char *cp, char *cs, char *dc);

#endif

#ifdef	__cplusplus
}
#endif

#endif

Site Stats

Snippets: 1791
Codebases: 571