You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@hyperreal.org on 1998/07/28 19:10:13 UTC

cvs commit: modperl/src/modules/perl Connection.xs Server.xs

dougm       98/07/28 10:10:13

  Added:       src/modules/perl Connection.xs Server.xs
  Log:
  oops, forgot to cvs add these
  
  Revision  Changes    Path
  1.1                  modperl/src/modules/perl/Connection.xs
  
  Index: Connection.xs
  ===================================================================
  #define CORE_PRIVATE 
  #include "mod_perl.h" 
  
  MODULE = Apache::Connection  PACKAGE = Apache::Connection
  
  PROTOTYPES: DISABLE
  
  BOOT: 
      items = items; /*avoid warning*/  
  
  #/* Things which are per connection
  # */
  
  #struct conn_rec {
  
  #  pool *pool;
  #  server_rec *server;
    
  #  /* Information about the connection itself */
    
  #  BUFF *client;			/* Connetion to the guy */
  #  int aborted;			/* Are we still talking? */
    
  #  /* Who is the client? */
    
  #  struct sockaddr_in local_addr; /* local address */
  #  struct sockaddr_in remote_addr;/* remote address */
  #  char *remote_ip;		/* Client's IP address */
  #  char *remote_host;		/* Client's DNS name, if known.
  #                                 * NULL if DNS hasn't been checked,
  #                                 * "" if it has and no address was found.
  #                                 * N.B. Only access this though
  #				 * get_remote_host() */
  
  int
  aborted(conn)
      Apache::Connection	conn
  
      CODE:
      RETVAL = conn->aborted || (conn->client && (conn->client->fd < 0));
  
      OUTPUT:
      RETVAL
  
  SV *
  local_addr(conn)
      Apache::Connection        conn
  
      CODE:
      RETVAL = newSVpv((char *)&conn->local_addr,
  		     sizeof conn->local_addr);
  
      OUTPUT:
      RETVAL
  
  SV *
  remote_addr(conn)
      Apache::Connection        conn
  
      CODE:
      RETVAL = newSVpv((char *)&conn->remote_addr,
                        sizeof conn->remote_addr);
  
      OUTPUT:
      RETVAL
  
  char *
  remote_ip(conn)
      Apache::Connection	conn
  
      CODE:
      RETVAL = conn->remote_ip;
  
      OUTPUT:
      RETVAL
  
  char *
  remote_host(conn)
      Apache::Connection	conn
  
      CODE:
      RETVAL = conn->remote_host;
  
      OUTPUT:
      RETVAL
  
  #  char *remote_logname;		/* Only ever set if doing_rfc931
  #                                 * N.B. Only access this through
  #				 * get_remote_logname() */
  #    char *user;			/* If an authentication check was made,
  #				 * this gets set to the user name.  We assume
  #				 * that there's only one user per connection(!)
  #				 */
  #  char *auth_type;		/* Ditto. */
  
  char *
  remote_logname(conn)
      Apache::Connection	conn
  
      CODE:
      RETVAL = conn->remote_logname;
  
      OUTPUT:
      RETVAL
  
  char *
  user(conn, ...)
      Apache::Connection	conn
  
      CODE:
      RETVAL = conn->user;
  
      if(items > 1)
          conn->user = pstrdup(conn->pool, (char *)SvPV(ST(1),na));
  
      OUTPUT:
      RETVAL
  
  char *
  auth_type(conn, ...)
      Apache::Connection	conn
  
      CODE:
      RETVAL = conn->auth_type;
  
      if(items > 1)
          conn->auth_type = pstrdup(conn->pool, (char *)SvPV(ST(1),na));
  
      OUTPUT:
      RETVAL
  
  #  int keepalive;		/* Are we using HTTP Keep-Alive? */
  #  int keptalive;		/* Did we use HTTP Keep-Alive? */
  #  int keepalives;		/* How many times have we used it? */
  #};
  
  
  
  
  
  1.1                  modperl/src/modules/perl/Server.xs
  
  Index: Server.xs
  ===================================================================
  #define CORE_PRIVATE 
  #include "mod_perl.h" 
  
  MODULE = Apache::Server  PACKAGE = Apache::Server
  
  PROTOTYPES: DISABLE
  
  BOOT: 
      items = items; /*avoid warning*/  
  
  #/* Per-vhost config... */
  
  #struct server_rec {
  
  #  server_rec *next;
    
  #  /* Full locations of server config info */
    
  #  char *srm_confname;
  #  char *access_confname;
    
  #  /* Contact information */
    
  #  char *server_admin;
  #  char *server_hostname;
  #  short port;                    /* for redirects, etc. */
  
  char *
  server_admin(server, ...)
      Apache::Server	server
  
      CODE:
      RETVAL = server->server_admin;
  
      OUTPUT:
      RETVAL
  
  char *
  server_hostname(server)
      Apache::Server	server
  
      CODE:
      RETVAL = server->server_hostname;
  
      OUTPUT:
      RETVAL
  
  short
  port(server, ...)
      Apache::Server	server
  
      CODE:
      RETVAL = server->port;
  
      if(items > 1)
          server->port = (short)SvIV(ST(1));
  
      OUTPUT:
      RETVAL
    
  #  /* Log files --- note that transfer log is now in the modules... */
    
  #  char *error_fname;
  #  FILE *error_log;
  
  #  /* Module-specific configuration for server, and defaults... */
  
  #  int is_virtual;               /* true if this is the virtual server */
  #  void *module_config;		/* Config vector containing pointers to
  #				 * modules' per-server config structures.
  #				 */
  #  void *lookup_defaults;	/* MIME type info, etc., before we start
  #				 * checking per-directory info.
  #				 */
  #  /* Transaction handling */
  
  #  struct in_addr host_addr;	/* The bound address, for this server */
  #  short host_port;              /* The bound port, for this server */
  #  int timeout;			/* Timeout, in seconds, before we give up */
  #  int keep_alive_timeout;	/* Seconds we'll wait for another request */
  #  int keep_alive_max;		/* Maximum requests per connection */
  #  int keep_alive;		/* Use persistent connections? */
  
  #  char *names;			/* Wildcarded names for HostAlias servers */
  #  char *virthost;		/* The name given in <VirtualHost> */
  
  int
  is_virtual(server)
      Apache::Server	server
  
      CODE:
      RETVAL = server->is_virtual;
  
      OUTPUT:
      RETVAL
  
  char *
  names(server)
      Apache::Server	server
  
      CODE:
  #if MODULE_MAGIC_NUMBER < 19980305
      RETVAL = server->names;
  #else
      RETVAL = ""; /* XXX: fixme */			   
  #endif
  
      OUTPUT:
      RETVAL