]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/client.h
Merge pull request #5410 from AOSC-Dev/master
[thirdparty/cups.git] / scheduler / client.h
index 6caa83f245291f34378c78b172c894f3e89bd6ce..fc7af5400d4be636ea6a167092200c9a8809731f 100644 (file)
@@ -1,37 +1,38 @@
 /*
- * "$Id: client.h 6649 2007-07-11 21:46:42Z mike $"
+ * Client definitions for the CUPS scheduler.
  *
- *   Client definitions for the Common UNIX Printing System (CUPS) scheduler.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   Copyright 2007 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- *   which should have been included with this file.  If this file is
- *   file is missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 #ifdef HAVE_AUTHORIZATION_H
 #  include <Security/Authorization.h>
 #endif /* HAVE_AUTHORIZATION_H */
 
+
 /*
  * HTTP client structure...
  */
 
 struct cupsd_client_s
 {
-  http_t               http;           /* HTTP client connection */
+  int                  number;         /* Connection number */
+  http_t               *http;          /* HTTP client connection */
   ipp_t                        *request,       /* IPP request information */
                        *response;      /* IPP response information */
   cupsd_location_t     *best;          /* Best match for AAA */
-  time_t               start;          /* Request start time */
+  struct timeval       start;          /* Request start time */
   http_state_t         operation;      /* Request operation */
   off_t                        bytes;          /* Bytes transferred for this request */
-  char                 username[33],   /* Username from Authorization: line */
-                       password[33],   /* Password from Authorization: line */
+  int                  is_browser;     /* Is the client a web browser? */
+  int                  type;           /* AuthType for username */
+  char                 username[HTTP_MAX_VALUE],
+                                       /* Username from Authorization: line */
+                       password[HTTP_MAX_VALUE],
+                                       /* Password from Authorization: line */
                        uri[HTTP_MAX_URI],
                                        /* Localized URL/URI for GET/PUT */
                        *filename,      /* Filename of output file */
@@ -41,30 +42,30 @@ struct cupsd_client_s
   int                  file;           /* Input/output file */
   int                  file_ready;     /* Input ready on file/pipe? */
   int                  pipe_pid;       /* Pipe process ID (or 0 if not a pipe) */
+  http_status_t                pipe_status;    /* HTTP status from pipe process */
   int                  sent_header,    /* Non-zero if sent HTTP header */
                        got_fields,     /* Non-zero if all fields seen */
-                       field_col;      /* Column within line */
+                       header_used;    /* Number of header bytes used */
+  char                 header[2048];   /* Header from CGI program */
   cups_lang_t          *language;      /* Language to use */
 #ifdef HAVE_SSL
   int                  auto_ssl;       /* Automatic test for SSL/TLS */
 #endif /* HAVE_SSL */
-  http_addr_t          clientaddr;     /* Client address */
+  http_addr_t          clientaddr;     /* Client's server address */
+  char                 clientname[256];/* Client's server name for connection */
+  int                  clientport;     /* Client's server port for connection */
   char                 servername[256];/* Server name for connection */
   int                  serverport;     /* Server port for connection */
 #ifdef HAVE_GSSAPI
-  int                  gss_have_creds; /* Have authenticated credentials */
-  int                  no_negotiate;   /* Don't offer WWW-Authenticate: Negotiate */
-  gss_buffer_desc      gss_output_token;
-                                       /* Output token for Negotiate header */
-  gss_cred_id_t        gss_delegated_cred;
-                                       /* Credentials from client header */
+  int                  have_gss;       /* Have GSS credentials? */
+  uid_t                        gss_uid;        /* User ID for local prints */
 #endif /* HAVE_GSSAPI */
 #ifdef HAVE_AUTHORIZATION_H
   AuthorizationRef     authref;        /* Authorization ref */
 #endif /* HAVE_AUTHORIZATION_H */
 };
 
-#define HTTP(con) &((con)->http)
+#define HTTP(con) ((con)->http)
 
 
 /*
@@ -76,6 +77,9 @@ typedef struct
   int                  fd;             /* File descriptor for this server */
   http_addr_t          address;        /* Bind address of socket */
   http_encryption_t    encryption;     /* To encrypt or not to encrypt... */
+#ifdef HAVE_ONDEMAND
+  int                  on_demand;      /* Is this a socket from launchd/systemd/upstart? */
+#endif /* HAVE_ONDEMAND */
 } cupsd_listener_t;
 
 
@@ -83,18 +87,24 @@ typedef struct
  * Globals...
  */
 
-VAR int                        ListenBackLog   VALUE(SOMAXCONN),
+VAR int                        LastClientNumber VALUE(0),
+                                       /* Last client connection number */
+                       ListenBackLog   VALUE(SOMAXCONN),
                                        /* Max backlog of pending connections */
-                       LocalPort       VALUE(631);
+                       LocalPort       VALUE(631),
                                        /* Local port to use */
+                       RemotePort      VALUE(0);
+                                       /* Remote port to use */
 VAR http_encryption_t  LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED);
                                        /* Local port encryption to use */
 VAR cups_array_t       *Listeners      VALUE(NULL);
                                        /* Listening sockets */
-VAR cups_array_t       *Clients        VALUE(NULL);
+VAR time_t             ListeningPaused VALUE(0);
+                                       /* Time when listening was paused */
+VAR cups_array_t       *Clients        VALUE(NULL),
                                        /* HTTP clients */
-VAR http_addrlist_t    *ServerAddrs    VALUE(NULL);
-                                       /* Server address(es) */
+                       *ActiveClients  VALUE(NULL);
+                                       /* Active HTTP clients */
 VAR char               *ServerHeader   VALUE(NULL);
                                        /* Server header in requests */
 VAR int                        CGIPipes[2]     VALUE2(-1,-1);
@@ -111,7 +121,6 @@ extern void cupsdAcceptClient(cupsd_listener_t *lis);
 extern void    cupsdCloseAllClients(void);
 extern int     cupsdCloseClient(cupsd_client_t *con);
 extern void    cupsdDeleteAllListeners(void);
-extern int     cupsdFlushHeader(cupsd_client_t *con);
 extern void    cupsdPauseListening(void);
 extern int     cupsdProcessIPPRequest(cupsd_client_t *con);
 extern void    cupsdReadClient(cupsd_client_t *con);
@@ -128,7 +137,7 @@ extern void cupsdStopListening(void);
 extern void    cupsdUpdateCGI(void);
 extern void    cupsdWriteClient(cupsd_client_t *con);
 
-
-/*
- * End of "$Id: client.h 6649 2007-07-11 21:46:42Z mike $".
- */
+#ifdef HAVE_SSL
+extern int     cupsdEndTLS(cupsd_client_t *con);
+extern int     cupsdStartTLS(cupsd_client_t *con);
+#endif /* HAVE_SSL */