|  | The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
    | 
Functions to produce and parse the FreeRADIUS presentation format. More...
#include <freeradius-devel/build.h>#include <freeradius-devel/missing.h>#include <freeradius-devel/util/talloc.h>#include <stddef.h>#include <stdint.h> Include dependency graph for print.h:
 Include dependency graph for print.h:Go to the source code of this file.
| Macros | |
| #define | is_truncated(_ret, _max) ((_ret) >= (size_t)(_max)) | 
| #define | truncate_len(_ret, _max) (((_ret) >= (size_t)(_max)) ? (((size_t)(_max)) - 1) : _ret) | 
| Functions | |
| char * | fr_asprint (TALLOC_CTX *ctx, char const *in, ssize_t inlen, char quote) | 
| Escape string that may contain binary data, and write it to a new buffer. | |
| char * | fr_asprintf (TALLOC_CTX *ctx, char const *fmt,...)) | 
| Special version of asprintf which implements custom format specifiers. | |
| ssize_t | fr_fprintf (FILE *stream, char const *fmt,...)) | 
| Special version of fprintf which implements custom format specifiers. | |
| size_t | fr_snprint (char *out, size_t outlen, char const *in, ssize_t inlen, char quote) | 
| Escape any non printable or non-UTF8 characters in the input string. | |
| size_t | fr_snprint_len (char const *in, ssize_t inlen, char quote) | 
| Find the length of the buffer required to fully escape a string with fr_prints. | |
| size_t | fr_utf8_char (uint8_t const *str, ssize_t inlen) | 
| Checks for utf-8, taken from http://www.w3.org/International/questions/qa-forms-utf-8. | |
| ssize_t | fr_utf8_str (uint8_t const *str, ssize_t inlen) | 
| Validate a complete UTF8 string. | |
| char const * | fr_utf8_strchr (int *chr_len, char const *str, ssize_t inlen, char const *chr) | 
| Return a pointer to the first UTF8 char in a string. | |
| char * | fr_vasprintf (TALLOC_CTX *ctx, char const *fmt, va_list ap) | 
| char * | fr_vasprintf_secure (TALLOC_CTX *ctx, char const *fmt, va_list ap) | 
Functions to produce and parse the FreeRADIUS presentation format.
Definition in file print.h.
| char * fr_asprint | ( | TALLOC_CTX * | ctx, | 
| char const * | in, | ||
| ssize_t | inlen, | ||
| char | quote | ||
| ) | 
Escape string that may contain binary data, and write it to a new buffer.
This is useful in situations where we expect printable strings as input, but under some conditions may get binary data. A good example is libldap and the arrays of struct berval ldap_get_values_len returns.
| [in] | ctx | To allocate new buffer in. | 
| [in] | in | String to escape. | 
| [in] | inlen | Length of string. Should be >= 0 if the data may contain embedded \0s. Must be >= 0 if data may not be \0 terminated. If < 0 inlen will be calculated using strlen. | 
| [in] | quote | the quotation character. | 
Definition at line 438 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| char * fr_asprintf | ( | TALLOC_CTX * | ctx, | 
| char const * | fmt, | ||
| ... | |||
| ) | 
Special version of asprintf which implements custom format specifiers.
| [in] | ctx | to allocate buffer in. | 
| [in] | fmt | string. | 
| [in] | ... | variadic argument list. | 
Definition at line 884 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| ssize_t fr_fprintf | ( | FILE * | fp, | 
| char const * | fmt, | ||
| ... | |||
| ) | 
Special version of fprintf which implements custom format specifiers.
| [in] | fp | to write the result of fmt string. | 
| [in] | fmt | string. | 
| [in] | ... | variadic argument list. | 
Definition at line 907 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:Escape any non printable or non-UTF8 characters in the input string.
| [out] | out | where to write the escaped string. | 
| [out] | outlen | the length of the buffer pointed to by out. | 
| [in] | in | string to escape. | 
| [in] | inlen | length of string to escape (lets us deal with embedded NULs) | 
| [in] | quote | the quotation character | 
Definition at line 237 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:Find the length of the buffer required to fully escape a string with fr_prints.
Were assuming here that's it's cheaper to figure out the length and do one alloc than repeatedly expand the buffer when we find extra chars which need to be added.
| in | string to calculate the escaped length for. | |
| inlen | length of the input string, if < 0 strlen will be used to check the length. | |
| [in] | quote | the quotation character. | 
Definition at line 419 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:Checks for utf-8, taken from http://www.w3.org/International/questions/qa-forms-utf-8.
| [in] | str | input string. | 
| [in] | inlen | length of input string. May be -1 if str is \0 terminated. | 
Definition at line 39 of file print.c.
 Here is the caller graph for this function:
 Here is the caller graph for this function:Validate a complete UTF8 string.
| [in] | str | input string. | 
| [in] | inlen | length of input string. May be -1 if str is \0 terminated. | 
Definition at line 153 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| char const * fr_utf8_strchr | ( | int * | out_chr_len, | 
| char const * | str, | ||
| ssize_t | inlen, | ||
| char const * | chr | ||
| ) | 
Return a pointer to the first UTF8 char in a string.
| [out] | out_chr_len | Where to write the length of the multibyte char passed in chr (may be NULL). | 
| [in] | str | Haystack. | 
| [in] | inlen | Length of string (in bytes). Pass -1 to determine the length of the string. | 
| [in] | chr | Multibyte needle. | 
Definition at line 184 of file print.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| char * fr_vasprintf | ( | TALLOC_CTX * | ctx, | 
| char const * | fmt, | ||
| va_list | ap | ||
| ) | 
 1.9.8
 1.9.8