home *** CD-ROM | disk | FTP | other *** search
/ Programming with VisualAge for Java / IBMVJAVA.ISO / icswin95 / httpdw32.z / session.h < prev    next >
C/C++ Source or Header  |  1997-04-07  |  2KB  |  80 lines

  1. /*
  2.  * Copyright (c) 1994, 1995.  Netscape Communications Corporation.  All
  3.  * rights reserved.
  4.  *
  5.  * Use of this software is governed by the terms of the license agreement for
  6.  * the Netscape Communications or Netscape Comemrce Server between the
  7.  * parties.
  8.  */
  9.  
  10.  
  11. /* ------------------------------------------------------------------------ */
  12.  
  13. /*
  14.  * NSsession.h: Deals with virtual sessions
  15.  *
  16.  * A session is the time between when a client connects and when it
  17.  * disconnects. Several requests may be handled in one session.
  18.  *
  19.  * Rob McDuel
  20.  */
  21.  
  22.  
  23. #ifndef NSSESSION_H
  24. #define NSSESSION_H
  25.  
  26. #include "base/pblock.h"
  27. #include "base/net.h"
  28. #include "base/buffer.h"
  29.  
  30. /* ------------------------------ Structures ------------------------------ */
  31.  
  32.  
  33. #define SESSION_HASHSIZE 5
  34.  
  35.  
  36. typedef struct {
  37.     /* Client-specific information */
  38.     pblock *client;
  39.  
  40.     SYS_NETFD csd;
  41.     netbuf *inbuf;
  42.  
  43.     /* struct in_addr iaddr; */
  44. } Session;
  45.  
  46.  
  47. /* ------------------------------ Prototypes ------------------------------ */
  48.  
  49.  
  50. /*
  51.  * session_create creates a new request structure for the client with the
  52.  * given socket descriptor and sockaddr.
  53.  */
  54.  
  55. Session *session_create(SYS_NETFD csd, struct sockaddr_in *sac);
  56.  
  57. /*
  58.  * session_free frees the given session
  59.  */
  60.  
  61. void session_free(Session *sn);
  62.  
  63. /*
  64.  * session_dns returns the DNS hostname of the client of this session,
  65.  * and inserts it into the client pblock. Returns NULL if unavailable.
  66.  */
  67.  
  68. #define session_dns(sn) session_dns_lookup(sn, 0)
  69.  
  70. /*
  71.  * session_maxdns looks up a hostname from an IP address, and then verifies
  72.  * that the host is really who they claim to be.
  73.  */
  74.  
  75. #define session_maxdns(sn) session_dns_lookup(sn, 1)
  76.  
  77. char *session_dns_lookup(Session *sn, int verify);
  78.  
  79. #endif
  80.