MCPcopy Create free account
hub / github.com/OpenPrinting/cups / ipp_read_io

Function ipp_read_io

cups/ipp.c:5951–6680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5949 */
5950
5951static ipp_state_t /* O - Current state */
5952ipp_read_io(void *src, /* I - Data source */
5953 ipp_iocb_t cb, /* I - Read callback function */
5954 int blocking, /* I - Use blocking IO? */
5955 ipp_t *parent, /* I - Parent request, if any */
5956 ipp_t *ipp, /* I - IPP data */
5957 int depth) /* I - Depth of collection */
5958{
5959 int n; /* Length of data */
5960 unsigned char *buffer, /* Data buffer */
5961 string[IPP_MAX_TEXT],
5962 /* Small string buffer */
5963 *bufptr, /* Pointer into buffer */
5964 *bufend; /* End of buffer */
5965 ipp_attribute_t *attr = NULL; /* Current attribute */
5966 ipp_tag_t tag; /* Current tag */
5967 ipp_tag_t value_tag; /* Current value tag */
5968 _ipp_value_t *value; /* Current value */
5969
5970
5971 DEBUG_printf(("ipp_read_io(src=%p, cb=%p, blocking=%d, parent=%p, ipp=%p, depth=%d)", (void *)src, (void *)cb, blocking, (void *)parent, (void *)ipp, depth));
5972 DEBUG_printf(("2ipp_read_io: ipp->state=%d", ipp->state));
5973
5974 if (depth > 10)
5975 {
5976 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP message nested too deeply."), 1);
5977 return (IPP_STATE_ERROR);
5978 }
5979
5980 if ((buffer = (unsigned char *)_cupsBufferGet(IPP_BUF_SIZE)) == NULL)
5981 {
5982 DEBUG_puts("1ipp_read_io: Unable to get read buffer.");
5983 return (IPP_STATE_ERROR);
5984 }
5985
5986 switch (ipp->state)
5987 {
5988 case IPP_STATE_IDLE :
5989 ipp->state ++; /* Avoid common problem... */
5990
5991 case IPP_STATE_HEADER :
5992 if (parent == NULL)
5993 {
5994 /*
5995 * Get the request header...
5996 */
5997
5998 if ((*cb)(src, buffer, 8) < 8)
5999 {
6000 DEBUG_puts("1ipp_read_io: Unable to read header.");
6001 goto rollback;
6002 }
6003
6004 /*
6005 * Then copy the request header over...
6006 */
6007
6008 ipp->request.any.version[0] = buffer[0];

Callers 3

ippReadFunction · 0.85
ippReadFileFunction · 0.85
ippReadIOFunction · 0.85

Calls 11

_cupsSetErrorFunction · 0.85
_cupsBufferGetFunction · 0.85
ippAddSeparatorFunction · 0.85
ippTagStringFunction · 0.85
ippSetValueTagFunction · 0.85
ipp_set_valueFunction · 0.85
ipp_add_attrFunction · 0.85
_cupsStrAllocFunction · 0.85
ippNewFunction · 0.85
_cupsBufferReleaseFunction · 0.85
ippDeleteAttributeFunction · 0.85

Tested by

no test coverage detected