]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Syncronize 1.1.x and 1.2 IPP support code.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 14 Mar 2003 22:14:33 +0000 (22:14 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 14 Mar 2003 22:14:33 +0000 (22:14 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3480 7a7537e8-13f0-0310-91df-b6672ffda945

cups/ipp.c
cups/ipp.h

index a6607b84a7df620ea01e79b154388f821089f732..142f4edf31038caec388699bd19a23dcd424e765 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.55.2.29 2003/02/11 18:23:29 mike Exp $"
+ * "$Id: ipp.c,v 1.55.2.30 2003/03/14 22:14:32 mike Exp $"
  *
  *   Internet Printing Protocol support functions for the Common UNIX
  *   Printing System (CUPS).
@@ -61,9 +61,7 @@
  *                            collection value.
  *   ipp_read_http()        - Semi-blocking read on a HTTP connection...
  *   ipp_read_file()        - Read IPP data from a file.
- *   ipp_read_mem()         - Read IPP data from memory.
  *   ipp_write_file()       - Write IPP data to a file.
- *   ipp_write_mem()        - Write IPP data to memory.
  */
 
 /*
 #include <errno.h>
 
 
-/*
- * Memory read/write info...
- */
-
-typedef struct
-{
-  ipp_uchar_t  *current,                       /* Current byte in buffer */
-               *end;                           /* Last byte in buffer */
-} ipp_mem_t;
-
-
 /*
  * Local functions...
  */
@@ -98,9 +85,7 @@ typedef struct
 static size_t          ipp_length(ipp_t *ipp, int collection);
 static int             ipp_read_http(http_t *http, ipp_uchar_t *buffer, int length);
 static int             ipp_read_file(int *fd, ipp_uchar_t *buffer, int length);
-static int             ipp_read_mem(ipp_mem_t *m, ipp_uchar_t *buffer, int length);
 static int             ipp_write_file(int *fd, ipp_uchar_t *buffer, int length);
-static int             ipp_write_mem(ipp_mem_t *m, ipp_uchar_t *buffer, int length);
 
 
 /*
@@ -2476,33 +2461,6 @@ ipp_read_file(int         *fd,                   /* I - File descriptor */
 }
 
 
-/*
- * 'ipp_read_mem()' - Read IPP data from memory.
- */
-
-static int                                     /* O - Number of bytes read */
-ipp_read_mem(ipp_mem_t   *m,                   /* I - Memory buffer */
-             ipp_uchar_t *buffer,              /* O - Read buffer */
-            int         length)                /* I - Number of bytes to read */
-{
-  int avail;                                   /* Number of bytes in buffer */
-
-
-  avail = m->end - m->current;
-
-  if (avail == 0)
-    return (-1);
-
-  if (length > avail)
-    length = avail;
-
-  memcpy(buffer, m->current, length);
-  m->current += length;
-
-  return (length);
-}
-
-
 /*
  * 'ipp_write_file()' - Write IPP data to a file.
  */
@@ -2517,32 +2475,5 @@ ipp_write_file(int         *fd,                  /* I - File descriptor */
 
 
 /*
- * 'ipp_write_mem()' - Write IPP data to memory.
- */
-
-static int                                     /* O - Number of bytes written */
-ipp_write_mem(ipp_mem_t   *m,                  /* I - Memory buffer */
-              ipp_uchar_t *buffer,             /* I - Data to write */
-             int         length)               /* I - Number of bytes to write */
-{
-  int avail;                                   /* Number of bytes in buffer */
-
-
-  avail = m->end - m->current;
-
-  if (avail == 0)
-    return (-1);
-
-  if (length > avail)
-    length = avail;
-
-  memcpy(m->current, buffer, length);
-  m->current += length;
-
-  return (length);
-}
-
-
-/*
- * End of "$Id: ipp.c,v 1.55.2.29 2003/02/11 18:23:29 mike Exp $".
+ * End of "$Id: ipp.c,v 1.55.2.30 2003/03/14 22:14:32 mike Exp $".
  */
index 96052aa6c641172d1131c3b89d8ce1840249085d..0f96c482d38a7750c00db99967ff3ddb89e9e649 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.h,v 1.36.2.14 2003/01/24 20:45:13 mike Exp $"
+ * "$Id: ipp.h,v 1.36.2.15 2003/03/14 22:14:33 mike Exp $"
  *
  *   Internet Printing Protocol definitions for the Common UNIX Printing
  *   System (CUPS).
@@ -25,8 +25,8 @@
  *   This file is subject to the Apple OS-Developed Software exception.
  */
 
-#ifndef _IPP_IPP_H_
-#  define _IPP_IPP_H_
+#ifndef _CUPS_IPP_H_
+#  define _CUPS_IPP_H_
 
 /*
  * Include necessary headers...
@@ -307,6 +307,7 @@ typedef enum                        /**** IPP status codes... ****/
 
 typedef unsigned char ipp_uchar_t;/**** Unsigned 8-bit integer/character ****/
 
+/**** New in CUPS 1.1.19 ****/
 typedef int    (*ipp_iocb_t)(void *, ipp_uchar_t *, int);
                                /**** IPP IO Callback Function ****/
 
@@ -319,13 +320,6 @@ typedef union                      /**** Request Header ****/
     int                request_id;     /* Request ID */
   }            any;
 
-  struct                       /* Event Header */
-  {
-    ipp_uchar_t        version[2];     /* Protocol version number */
-    int                status_code;    /* Status code */
-    int                request_id;     /* Request ID */
-  }            event;
-
   struct                       /* Operation Header */
   {
     ipp_uchar_t        version[2];     /* Protocol version number */
@@ -339,8 +333,17 @@ typedef union                      /**** Request Header ****/
     ipp_status_t status_code;  /* Status code */
     int                request_id;     /* Request ID */
   }            status;
-} ipp_header_t;
 
+  /**** New in CUPS 1.1.19 ****/
+  struct                       /* Event Header */
+  {
+    ipp_uchar_t        version[2];     /* Protocol version number */
+    int                status_code;    /* Status code */
+    int                request_id;     /* Request ID */
+  }            event;
+} ipp_request_t;
+
+/**** New in CUPS 1.1.19 ****/
 typedef struct ipp_str ipp_t;
 
 typedef union                  /**** Attribute Value ****/
@@ -349,8 +352,6 @@ typedef union                       /**** Attribute Value ****/
 
   char         boolean;        /* Boolean value */
 
-  ipp_t                *collection;    /* Collection value */
-
   ipp_uchar_t  date[11];       /* Date/time value */
 
   struct
@@ -377,6 +378,9 @@ typedef union                       /**** Attribute Value ****/
     int                length;         /* Length of attribute */
     void       *data;          /* Data in attribute */
   }            unknown;        /* Unknown attribute type */
+
+/**** New in CUPS 1.1.19 ****/
+  ipp_t                *collection;    /* Collection value */
 } ipp_value_t;
 
 typedef struct ipp_attribute_s /**** Attribute ****/
@@ -392,7 +396,7 @@ typedef struct ipp_attribute_s      /**** Attribute ****/
 struct ipp_str                 /**** IPP Request/Response/Notification ****/
 {
   ipp_state_t  state;          /* State of request */
-  ipp_header_t request;        /* Request header */
+  ipp_request_t        request;        /* Request header */
   ipp_attribute_t *attrs,      /* Attributes */
                *last,          /* Last attribute in list */
                *current;       /* Current attribute (for read/write) */
@@ -406,8 +410,6 @@ struct ipp_str                      /**** IPP Request/Response/Notification ****/
 
 extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group, const char *name, char value);
 extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const char *values);
-extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_t *value);
-extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const ipp_t **values);
 extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group, const char *name, const ipp_uchar_t *value);
 extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int value);
 extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const int *values);
@@ -420,7 +422,6 @@ extern ipp_attribute_t      *ippAddString(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type
 extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const char *charset, const char * const *values);
 extern time_t          ippDateToTime(const ipp_uchar_t *date);
 extern void            ippDelete(ipp_t *ipp);
-extern void            ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr);
 extern const char      *ippErrorString(ipp_status_t error);
 extern ipp_attribute_t *ippFindAttribute(ipp_t *ipp, const char *name,
                                          ipp_tag_t type);
@@ -429,15 +430,20 @@ extern ipp_attribute_t    *ippFindNextAttribute(ipp_t *ipp, const char *name,
 extern size_t          ippLength(ipp_t *ipp);
 extern ipp_t           *ippNew(void);
 extern ipp_state_t     ippRead(http_t *http, ipp_t *ipp);
-extern ipp_state_t     ippReadFile(int fd, ipp_t *ipp);
-extern ipp_state_t     ippReadIO(void *src, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
 extern const ipp_uchar_t *ippTimeToDate(time_t t);
 extern ipp_state_t     ippWrite(http_t *http, ipp_t *ipp);
-extern ipp_state_t     ippWriteFile(int fd, ipp_t *ipp);
-extern ipp_state_t     ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
 extern int             ippPort(void);
 extern void            ippSetPort(int p);
 
+/**** New in CUPS 1.1.19 ****/
+extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_t *value);
+extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const ipp_t **values);
+extern void            ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr);
+extern ipp_state_t     ippReadFile(int fd, ipp_t *ipp);
+extern ipp_state_t     ippReadIO(void *src, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
+extern ipp_state_t     ippWriteFile(int fd, ipp_t *ipp);
+extern ipp_state_t     ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp);
+
 
 /*
  * "Private" functions used internally by CUPS...
@@ -454,8 +460,8 @@ extern void         _ipp_free_attr(ipp_attribute_t *);
 #  ifdef __cplusplus
 }
 #  endif /* __cplusplus */
-#endif /* !_IPP_IPP_H_ */
+#endif /* !_CUPS_IPP_H_ */
 
 /*
- * End of "$Id: ipp.h,v 1.36.2.14 2003/01/24 20:45:13 mike Exp $".
+ * End of "$Id: ipp.h,v 1.36.2.15 2003/03/14 22:14:33 mike Exp $".
  */