]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/ipp-support.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / ipp-support.c
index fef06af1c42444244e1148d5692ffdb5732448c6..3ff58417f0612fe20f74064144c4f2544a68ae9d 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * "$Id: ipp-support.c 5246 2006-03-08 13:22:09Z mike $"
+ * "$Id: ipp-support.c 6503 2007-05-01 23:06:44Z mike $"
  *
  *   Internet Printing Protocol support functions for the Common UNIX
  *   Printing System (CUPS).
  *
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Easy Software Products and are protected by Federal
@@ -157,7 +157,8 @@ static char * const ipp_std_ops[] =
                  "CUPS-Get-Devices",
                  "CUPS-Get-PPDs",
                  "CUPS-Move-Job",
-                 "CUPS-Authenticate-Job"
+                 "CUPS-Authenticate-Job",
+                 "CUPS-Get-PPD"
                };
 
 
@@ -179,6 +180,8 @@ ippErrorString(ipp_status_t error)  /* I - Error status */
     return (ipp_status_oks[error]);
   else if (error == IPP_REDIRECTION_OTHER_SITE)
     return ("redirection-other-site");
+  else if (error == CUPS_SEE_OTHER)
+    return ("cups-see-other");
   else if (error >= IPP_BAD_REQUEST && error <= IPP_PRINT_SUPPORT_FILE_NOT_FOUND)
     return (ipp_status_400s[error - IPP_BAD_REQUEST]);
   else if (error >= IPP_INTERNAL_ERROR && error <= IPP_PRINTER_IS_DEACTIVATED)
@@ -213,6 +216,9 @@ ippErrorValue(const char *name)             /* I - Name */
   if (!strcasecmp(name, "redirection-other-site"))
     return (IPP_REDIRECTION_OTHER_SITE);
 
+  if (!strcasecmp(name, "cups-see-other"))
+    return (CUPS_SEE_OTHER);
+
   for (i = 0; i < (sizeof(ipp_status_400s) / sizeof(ipp_status_400s[0])); i ++)
     if (!strcasecmp(name, ipp_status_400s[i]))
       return ((ipp_status_t)(i + 0x400));
@@ -245,7 +251,7 @@ ippOpString(ipp_op_t op)            /* I - Operation ID */
     return (ipp_std_ops[op]);
   else if (op == IPP_PRIVATE)
     return ("windows-ext");
-  else if (op >= CUPS_GET_DEFAULT && op <= CUPS_AUTHENTICATE_JOB)
+  else if (op >= CUPS_GET_DEFAULT && op <= CUPS_GET_PPD)
     return (ipp_cups_ops[op - CUPS_GET_DEFAULT]);
 
  /*
@@ -304,19 +310,48 @@ ippPort(void)
   _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
 
 
+  DEBUG_puts("ippPort()");
+
+  if (!cg->ipp_port)
+  {
+   /*
+    * See if the server definition includes the port number...
+    */
+
+    DEBUG_puts("ippPort: Not initialized...");
+
+    cupsServer();
+
+#ifdef DEBUG
+    if (cg->ipp_port)
+      puts("ippPort: Set via cupsServer()...");
+#endif /* DEBUG */
+  }
+
   if (!cg->ipp_port)
   {
     if ((ipp_port = getenv("IPP_PORT")) != NULL)
+    {
+      DEBUG_puts("ippPort: Set via IPP_PORT...");
       portnum = atoi(ipp_port);
+    }
     else if ((port = getservbyname("ipp", NULL)) == NULL)
+    {
+      DEBUG_puts("ippPort: Set via CUPS_DEFAULT_IPP_PORT...");
       portnum = CUPS_DEFAULT_IPP_PORT;
+    }
     else
+    {
+      DEBUG_puts("ippPort: Set via ipp service entry...");
       portnum = ntohs(port->s_port);
+    }
 
     if (portnum > 0)
       cg->ipp_port = portnum;
   }
 
+  DEBUG_printf(("ippPort: Returning %d...\n", cg->ipp_port));
+
   return (cg->ipp_port);
 }
 
@@ -328,10 +363,12 @@ ippPort(void)
 void
 ippSetPort(int p)                      /* I - Port number to use */
 {
+  DEBUG_printf(("ippSetPort(p=%d)\n", p));
+
   _cupsGlobals()->ipp_port = p;
 }
 
 
 /*
- * End of "$Id: ipp-support.c 5246 2006-03-08 13:22:09Z mike $".
+ * End of "$Id: ipp-support.c 6503 2007-05-01 23:06:44Z mike $".
  */