/* * Oh, the wonderful world of IPv6 compatibility. Apparently some * implementations expose the (more logical) 32-bit address parts * to everyone, while others only expose it to kernel code... To * make supporting IPv6 even easier, each vendor chose different * core structure and union names, so the same defines or code * can't be used on all platforms. * * The following will likely need tweaking on new platforms that * support IPv6 - the "s6_addr32" define maps to the 32-bit integer * array in the in6_addr union, which is named differently on various * platforms.
*/
#ifdefined(AF_INET6) && !defined(s6_addr32) # ifdefined(__sun) # define s6_addr32 _S6_un._S6_u32 # elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)|| defined(__DragonFly__) # define s6_addr32 __u6_addr.__u6_addr32 # elif defined(_WIN32) /* * Windows only defines byte and 16-bit word members of the union and * requires special casing of all raw address code...
*/ # define s6_addr32 error_need_win32_specific_code # endif /* __sun */ #endif/* AF_INET6 && !s6_addr32 */
/* * Limits...
*/
# define HTTP_MAX_URI 1024 /* Max length of URI string */ # define HTTP_MAX_HOST 256 /* Max length of hostname string */ # define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */ # define HTTP_MAX_VALUE 256 /* Max header field value length */
/* * Types and structures...
*/
typedefenum http_auth_e /**** HTTP authentication types @exclude all@ ****/
{
HTTP_AUTH_NONE, /* No authentication in use */
HTTP_AUTH_BASIC, /* Basic authentication in use */
HTTP_AUTH_MD5, /* Digest authentication in use */
HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */
HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */
HTTP_AUTH_MD5_SESS_INT, /* MD5-session authentication in use for body */
HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3/macOS 10.5@ */
} http_auth_t;
typedefenum http_encoding_e /**** HTTP transfer encoding values ****/
{
HTTP_ENCODING_LENGTH, /* Data is sent with Content-Length */
HTTP_ENCODING_CHUNKED, /* Data is chunked */
HTTP_ENCODING_FIELDS /* Sending HTTP fields */
typedefenum http_field_e /**** HTTP field names ****/
{
HTTP_FIELD_UNKNOWN = -1, /* Unknown field */
HTTP_FIELD_ACCEPT_LANGUAGE, /* Accept-Language field */
HTTP_FIELD_ACCEPT_RANGES, /* Accept-Ranges field */
HTTP_FIELD_AUTHORIZATION, /* Authorization field */
HTTP_FIELD_CONNECTION, /* Connection field */
HTTP_FIELD_CONTENT_ENCODING, /* Content-Encoding field */
HTTP_FIELD_CONTENT_LANGUAGE, /* Content-Language field */
HTTP_FIELD_CONTENT_LENGTH, /* Content-Length field */
HTTP_FIELD_CONTENT_LOCATION, /* Content-Location field */
HTTP_FIELD_CONTENT_MD5, /* Content-MD5 field */
HTTP_FIELD_CONTENT_RANGE, /* Content-Range field */
HTTP_FIELD_CONTENT_TYPE, /* Content-Type field */
HTTP_FIELD_CONTENT_VERSION, /* Content-Version field */
HTTP_FIELD_DATE, /* Date field */
HTTP_FIELD_HOST, /* Host field */
HTTP_FIELD_IF_MODIFIED_SINCE, /* If-Modified-Since field */
HTTP_FIELD_IF_UNMODIFIED_SINCE, /* If-Unmodified-Since field */
HTTP_FIELD_KEEP_ALIVE, /* Keep-Alive field */
HTTP_FIELD_LAST_MODIFIED, /* Last-Modified field */
HTTP_FIELD_LINK, /* Link field */
HTTP_FIELD_LOCATION, /* Location field */
HTTP_FIELD_RANGE, /* Range field */
HTTP_FIELD_REFERER, /* Referer field */
HTTP_FIELD_RETRY_AFTER, /* Retry-After field */
HTTP_FIELD_TRANSFER_ENCODING, /* Transfer-Encoding field */
HTTP_FIELD_UPGRADE, /* Upgrade field */
HTTP_FIELD_USER_AGENT, /* User-Agent field */
HTTP_FIELD_WWW_AUTHENTICATE, /* WWW-Authenticate field */
HTTP_FIELD_ACCEPT_ENCODING, /* Accepting-Encoding field @since CUPS 1.7/macOS 10.9@ */
HTTP_FIELD_ALLOW, /* Allow field @since CUPS 1.7/macOS 10.9@ */
HTTP_FIELD_SERVER, /* Server field @since CUPS 1.7/macOS 10.9@ */
HTTP_FIELD_AUTHENTICATION_INFO, /* Authentication-Info field (@since CUPS 2.2.9) */
HTTP_FIELD_MAX /* Maximum field index */
} http_field_t;
typedefenum http_keepalive_e /**** HTTP keep-alive values ****/
{
HTTP_KEEPALIVE_OFF = 0, /* No keep alive support */
HTTP_KEEPALIVE_ON /* Use keep alive */
} http_keepalive_t;
typedefenum http_state_e /**** HTTP state values; states **** are server-oriented...
****/
{
HTTP_STATE_ERROR = -1, /* Error on socket */
HTTP_STATE_WAITING, /* Waiting for command */
HTTP_STATE_OPTIONS, /* OPTIONS command, waiting for blank line */
HTTP_STATE_GET, /* GET command, waiting for blank line */
HTTP_STATE_GET_SEND, /* GET command, sending data */
HTTP_STATE_HEAD, /* HEAD command, waiting for blank line */
HTTP_STATE_POST, /* POST command, waiting for blank line */
HTTP_STATE_POST_RECV, /* POST command, receiving data */
HTTP_STATE_POST_SEND, /* POST command, sending data */
HTTP_STATE_PUT, /* PUT command, waiting for blank line */
HTTP_STATE_PUT_RECV, /* PUT command, receiving data */
HTTP_STATE_DELETE, /* DELETE command, waiting for blank line */
HTTP_STATE_TRACE, /* TRACE command, waiting for blank line */
HTTP_STATE_CONNECT, /* CONNECT command, waiting for blank line */
HTTP_STATE_STATUS, /* Command complete, sending status */
HTTP_STATE_UNKNOWN_METHOD, /* Unknown request method, waiting for blank line @since CUPS 1.7/macOS 10.9@ */
HTTP_STATE_UNKNOWN_VERSION /* Unknown request method, waiting for blank line @since CUPS 1.7/macOS 10.9@ */
HTTP_STATUS_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */
HTTP_STATUS_CREATED, /* PUT command was successful */
HTTP_STATUS_ACCEPTED, /* DELETE command was successful */
HTTP_STATUS_NOT_AUTHORITATIVE, /* Information isn't authoritative */
HTTP_STATUS_NO_CONTENT, /* Successful command, no new data */
HTTP_STATUS_RESET_CONTENT, /* Content was reset/recreated */
HTTP_STATUS_PARTIAL_CONTENT, /* Only a partial file was received/sent */
HTTP_STATUS_MULTIPLE_CHOICES = 300, /* Multiple files match request */
HTTP_STATUS_MOVED_PERMANENTLY, /* Document has moved permanently */
HTTP_STATUS_FOUND, /* Document was found at a different URI */
HTTP_STATUS_SEE_OTHER, /* See this other link */
HTTP_STATUS_NOT_MODIFIED, /* File not modified */
HTTP_STATUS_USE_PROXY, /* Must use a proxy to access this URI */
HTTP_STATUS_TEMPORARY_REDIRECT = 307, /* Temporary redirection */
HTTP_STATUS_BAD_REQUEST = 400, /* Bad request */
HTTP_STATUS_UNAUTHORIZED, /* Unauthorized to access host */
HTTP_STATUS_PAYMENT_REQUIRED, /* Payment required */
HTTP_STATUS_FORBIDDEN, /* Forbidden to access this URI */
HTTP_STATUS_NOT_FOUND, /* URI was not found */
HTTP_STATUS_METHOD_NOT_ALLOWED, /* Method is not allowed */
HTTP_STATUS_NOT_ACCEPTABLE, /* Not Acceptable */
HTTP_STATUS_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */
HTTP_STATUS_REQUEST_TIMEOUT, /* Request timed out */
HTTP_STATUS_CONFLICT, /* Request is self-conflicting */
HTTP_STATUS_GONE, /* Server has gone away */
HTTP_STATUS_LENGTH_REQUIRED, /* A content length or encoding is required */
HTTP_STATUS_PRECONDITION, /* Precondition failed */
HTTP_STATUS_REQUEST_TOO_LARGE, /* Request entity too large */
HTTP_STATUS_URI_TOO_LONG, /* URI too long */
HTTP_STATUS_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */
HTTP_STATUS_REQUESTED_RANGE, /* The requested range is not satisfiable */
HTTP_STATUS_EXPECTATION_FAILED, /* The expectation given in an Expect header field was not met */
HTTP_STATUS_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */
HTTP_STATUS_SERVER_ERROR = 500, /* Internal server error */
HTTP_STATUS_NOT_IMPLEMENTED, /* Feature not implemented */
HTTP_STATUS_BAD_GATEWAY, /* Bad gateway */
HTTP_STATUS_SERVICE_UNAVAILABLE, /* Service is unavailable */
HTTP_STATUS_GATEWAY_TIMEOUT, /* Gateway connection timed out */
HTTP_STATUS_NOT_SUPPORTED, /* HTTP version not supported */
HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED = 1000, /* User canceled authorization @since CUPS 1.4@ */
HTTP_STATUS_CUPS_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/macOS 10.7@ */
HTTP_STATUS_CUPS_WEBIF_DISABLED /* Web interface is disabled @private@ */
# define HTTP_STATUS_MOVED_TEMPORARILY HTTP_STATUS_FOUND /* Renamed in RFC 7231 */
# ifndef _CUPS_NO_DEPRECATED /* Old names for this enumeration */ # define HTTP_ERROR HTTP_STATUS_ERROR
typedefenum http_trust_e /**** Level of trust for credentials @since CUPS 2.0/OS 10.10@ */
{
HTTP_TRUST_OK = 0, /* Credentials are OK/trusted */
HTTP_TRUST_INVALID, /* Credentials are invalid */
HTTP_TRUST_CHANGED, /* Credentials have changed */
HTTP_TRUST_EXPIRED, /* Credentials are expired */
HTTP_TRUST_RENEWED, /* Credentials have been renewed */
HTTP_TRUST_UNKNOWN, /* Credentials are unknown/new */
} http_trust_t;
typedefenum http_uri_status_e /**** URI separation status @since CUPS 1.2@ ****/
{
HTTP_URI_STATUS_OVERFLOW = -8, /* URI buffer for httpAssembleURI is too small */
HTTP_URI_STATUS_BAD_ARGUMENTS = -7, /* Bad arguments to function (error) */
HTTP_URI_STATUS_BAD_RESOURCE = -6, /* Bad resource in URI (error) */
HTTP_URI_STATUS_BAD_PORT = -5, /* Bad port number in URI (error) */
HTTP_URI_STATUS_BAD_HOSTNAME = -4, /* Bad hostname in URI (error) */
HTTP_URI_STATUS_BAD_USERNAME = -3, /* Bad username in URI (error) */
HTTP_URI_STATUS_BAD_SCHEME = -2, /* Bad scheme in URI (error) */
HTTP_URI_STATUS_BAD_URI = -1, /* Bad/empty URI (error) */
HTTP_URI_STATUS_OK = 0, /* URI decoded OK */
HTTP_URI_STATUS_MISSING_SCHEME, /* Missing scheme in URI (warning) */
HTTP_URI_STATUS_UNKNOWN_SCHEME, /* Unknown scheme in URI (warning) */
HTTP_URI_STATUS_MISSING_RESOURCE /* Missing resource in URI (warning) */
typedefunion _http_addr_u /**** Socket address union, which **** makes using IPv6 and other **** address types easier and **** more portable. @since CUPS 1.2/macOS 10.5@
****/
{ struct sockaddr addr; /* Base structure for family value */ struct sockaddr_in ipv4; /* IPv4 address */ #ifdef AF_INET6 struct sockaddr_in6 ipv6; /* IPv6 address */ #endif/* AF_INET6 */ #ifdef AF_LOCAL struct sockaddr_un un; /* Domain socket file */ #endif/* AF_LOCAL */ char pad[256]; /* Padding to ensure binary compatibility */
} http_addr_t;
typedefstruct http_addrlist_s /**** Socket address list, which is **** used to enumerate all of the **** addresses that are associated **** with a hostname. @since CUPS 1.2/macOS 10.5@ **** @exclude all@
****/
{ struct http_addrlist_s *next; /* Pointer to next address in list */
http_addr_t addr; /* Address */
} http_addrlist_t;
typedefstruct _http_s http_t; /**** HTTP connection type ****/
typedefstruct http_credential_s /**** HTTP credential data @since CUPS 1.5/macOS 10.7@ @exclude all@ ****/
{ void *data; /* Pointer to credential data */
size_t datalen; /* Credential length */
} http_credential_t;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.