2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
13 /* $Id: php_http_headers_api.h 300300 2010-06-09 07:29:35Z mike $ */
15 #ifndef PHP_HTTP_NEGOTIATE_H
16 #define PHP_HTTP_NEGOTIATE_H
18 typedef char *(*php_http_negotiate_func_t
)(const char *test
, double *quality
, HashTable
*supported TSRMLS_DC
);
20 extern char *php_http_negotiate_language_func(const char *test
, double *quality
, HashTable
*supported TSRMLS_DC
);
21 extern char *php_http_negotiate_default_func(const char *test
, double *quality
, HashTable
*supported TSRMLS_DC
);
23 PHP_HTTP_API HashTable
*php_http_negotiate(const char *value
, HashTable
*supported
, php_http_negotiate_func_t neg TSRMLS_DC
);
25 static inline HashTable
*php_http_negotiate_language(HashTable
*supported TSRMLS_DC
)
27 HashTable
*result
= NULL
;
28 char *value
= php_http_env_get_request_header(ZEND_STRL("Accept-Language") TSRMLS_CC
);
31 result
= php_http_negotiate(value
, supported
, php_http_negotiate_language_func TSRMLS_CC
);
38 static inline HashTable
*php_http_negotiate_encoding(HashTable
*supported TSRMLS_DC
)
40 HashTable
*result
= NULL
;
41 char *value
= php_http_env_get_request_header(ZEND_STRL("Accept-Encoding") TSRMLS_CC
);
44 result
= php_http_negotiate(value
, supported
, NULL TSRMLS_CC
);
51 static inline HashTable
*php_http_negotiate_charset(HashTable
*supported TSRMLS_DC
)
53 HashTable
*result
= NULL
;
54 char *value
= php_http_env_get_request_header(ZEND_STRL("Accept-Charset") TSRMLS_CC
);
57 result
= php_http_negotiate(value
, supported
, NULL TSRMLS_CC
);
64 static inline HashTable
*php_http_negotiate_content_type(HashTable
*supported TSRMLS_DC
)
66 HashTable
*result
= NULL
;
67 char *value
= php_http_env_get_request_header(ZEND_STRL("Accept") TSRMLS_CC
);
70 result
= php_http_negotiate(value
, supported
, NULL TSRMLS_CC
);
85 * vim600: noet sw=4 ts=4 fdm=marker
86 * vim<600: noet sw=4 ts=4