Main Page | Data Structures | File List | Globals

libppr/ipp_utils.c File Reference

#include "before_system.h"
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "gu.h"
#include "global_defines.h"
#include "ipp_constants.h"
#include "ipp_utils.h"

Functions

IPP * ipp_new (const char root[], const char path_info[], int content_length, int in_fd, int out_fd)
 create IPP request handling object

void ipp_delete (struct IPP *p)
 Finish the IPP service transaction.

void ipp_set_remote_user (struct IPP *p, const char remote_user[])
 set REMOTE_USER from CGI environment

void ipp_set_remote_addr (struct IPP *p, const char remote_addr[])
 set REMOTE_ADDR from CGI environment

void ipp_request_to_fd (struct IPP *p, int fd)
 Save the IPP request to a file.

void ipp_reply_from_fd (struct IPP *p, int fd)
 Provide IPP object with an open file descriptor containing a substitute reply.

int ipp_get_block (struct IPP *p, char **pptr)
 fetch a block from the IPP request

unsigned char ipp_get_byte (struct IPP *p)
 fetch an unsigned byte from the IPP request

void ipp_put_byte (struct IPP *ipp, unsigned char val)
 append an unsigned byte to the IPP response

int ipp_get_sb (struct IPP *p)
 fetch a signed byte from the IPP request

int ipp_get_ss (struct IPP *p)
 fetch a signed short from the IPP request

int ipp_get_si (struct IPP *p)
 fetch a signed integer from the IPP request

void ipp_put_sb (struct IPP *p, int val)
 append a signed byte to the IPP response

void ipp_put_ss (struct IPP *p, int val)
 append a signed short to the IPP response

void ipp_put_si (struct IPP *p, int val)
 append a signed integer to the IPP response

unsigned char * ipp_get_bytes (struct IPP *p, int len)
 fetch a byte array of specified length

void ipp_put_bytes (struct IPP *ipp, const unsigned char *data, int len)
 append a byte array of a specified length

void ipp_put_string (struct IPP *ipp, const char string[])
 append a string to the reply

void ipp_parse_request_header (struct IPP *ipp)
 read the IPP request's header and store it in the IPP object

void ipp_parse_request_body (struct IPP *ipp)
 read more of the IPP request

void ipp_put_attr (struct IPP *ipp, ipp_attribute_t *attr)
 append an attribute to the IPP response

void ipp_send_reply (struct IPP *ipp, gu_boolean header)
 send the IPP response in the IPP object

void ipp_add_end (struct IPP *ipp, int group)
 add an object divider to the IPP response

void ipp_add_integer (struct IPP *ipp, int group, int tag, const char name[], int value)
 add an integer to the IPP response

void ipp_add_string (struct IPP *ipp, int group, int tag, const char name[], const char value[])
 add a string to the IPP response

void ipp_add_strings (struct IPP *ipp, int group, int tag, const char name[], int num_values, const char *values[])
 add a list of strings to the IPP response

void ipp_add_printf (struct IPP *ipp, int group, int tag, const char name[], const char value[],...)
 add a formatted string to the IPP response

void ipp_add_boolean (struct IPP *ipp, int group, int tag, const char name[], gu_boolean value)
 add a boolean to the IPP response

ipp_attribute_t * ipp_find_attribute (struct IPP *ipp, int group, int tag, const char name[])
 find an attribute in the IPP request


Detailed Description


Function Documentation

void ipp_add_string struct IPP *  ipp,
int  group,
int  tag,
const char  name[],
const char  value[]
 

add a string to the IPP response

This function keeps a pointer to name[] and value[], so they had better not change!

void ipp_add_strings struct IPP *  ipp,
int  group,
int  tag,
const char  name[],
int  num_values,
const char *  values[]
 

add a list of strings to the IPP response

This function keeps a pointer to name[] and all of the values[], so they had better not change!

void ipp_delete struct IPP *  p  ) 
 

Finish the IPP service transaction.

Any remaining request input bytes are read and discarded. Any bytes remaining in the The response output buffer are sent on their way. Finally, the IPP service object is destroyed.

int ipp_get_block struct IPP *  p,
char **  pptr
 

fetch a block from the IPP request

The character pointer pointed two by pptr is set to point to the next block of the file. The length of the block is returned. This is used to read the print file data.

unsigned char ipp_get_byte struct IPP *  p  ) 
 

fetch an unsigned byte from the IPP request

This is used to read tags.

struct IPP* ipp_new const char  root[],
const char  path_info[],
int  content_length,
int  in_fd,
int  out_fd
 

create IPP request handling object

This function creates an IPP service object. The IPP request will be read from stdin and the response will be sent to stdout. IPP data of various types can be read from the request and appended to the response using the member functions.

void ipp_parse_request_body struct IPP *  ipp  ) 
 

read more of the IPP request

This function picks up where ipp_parse_request_header() left off and reads up to (but not including) the print job data.

void ipp_parse_request_header struct IPP *  ipp  ) 
 

read the IPP request's header and store it in the IPP object

This function retrieves the operation ID. This is enough for the ipp CGI to decide if it can handle the request itself or needs to pass it to pprd. If it can handle the request itself, it goes on to call ipp_parse_request_body().

void ipp_put_byte struct IPP *  ipp,
unsigned char  val
 

append an unsigned byte to the IPP response

This is used to write tags.

void ipp_reply_from_fd struct IPP *  p,
int  fd
 

Provide IPP object with an open file descriptor containing a substitute reply.

If you open a file and pass the descriptor to this function, ipp_send_reply() will send the content of the file in the stead of whatever it would have sent.

void ipp_request_to_fd struct IPP *  p,
int  fd
 

Save the IPP request to a file.

Write the IPP request to a file in preparation for passing it through to another process for handling. Once you have done this, it is gone, you can't parse any more of it using this object.


Generated on Fri Feb 20 15:17:53 2004 for PPR Libraries by doxygen 1.3.5