📄 test_protos.h
字号:
* * @param home memory home used to allocate new header structure. * @param s string to be decoded as value of the new header structure * * @note This function is usually implemented as a macro calling * msg_header_make(). * * @return * The function msg_request_make() returns a pointer to * newly maked msg_request_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline msg_request_t *msg_request_make(su_home_t *home, char const *s){ return (msg_request_t *)msg_header_make(home, msg_request_class, s);}#elsemsg_request_t *msg_request_make(su_home_t *home, char const *s);#endif/**Make a request line from formatting result. * * The function msg_request_format() makes a new * request line object using formatting result as its * value. The function first prints the arguments according to * the format @a fmt specified. Then it allocates a new header * structure, and uses the formatting result as the header * value. * * @param home memory home used to allocate new header structure. * @param fmt string used as a printf()-style format * @param ... argument list for format * * @note This function is usually implemented as a macro calling * msg_header_format(). * * @return * The function msg_request_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifmsg_request_t *msg_request_format(su_home_t *home, char const *fmt, ...) __attribute__((__format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline msg_request_t *msg_request_format(su_home_t *home, char const *fmt, ...){ msg_header_t *h; va_list ap; va_start(ap, fmt); h = msg_header_vformat(home, msg_request_class, fmt, ap); va_end(ap); return (msg_request_t *)h;}#endif/** @} *//**@addtogroup test_msg_status*//**@{*//** Parse a status line. @internal */msg_parse_f msg_status_d;/** Print a status line. @internal */msg_print_f msg_status_e;/**Header class for status line. * * The header class msg_status_class defines how a * status line is parsed and printed. It also * contains methods used by message parser and other functions * to manipulate the msg_status_t header structure. */extern msg_hclass_t msg_status_class[];/**Initializer for structure msg_status_t. * * A static msg_status_t structure must be initialized * with the MSG_STATUS_INIT() macro. For instance, * @code * * msg_status_t msg_status = MSG_STATUS_INIT; * * @endcode * @HI */#define MSG_STATUS_INIT() MSG_HDR_INIT(status)/**Initialize a structure msg_status_t. * * An msg_status_t structure can be initialized with the * msg_status_init() function/macro. For instance, * @code * * msg_status_t msg_status; * * msg_status_init(&msg_status); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline msg_status_t *msg_status_init(msg_status_t x[1]){ return MSG_HEADER_INIT(x, msg_status_class, sizeof(msg_status_t));}#else#define msg_status_init(x) \ MSG_HEADER_INIT(x, msg_status_class, sizeof(msg_status_t))#endif/**Test if header object is instance of msg_status_t. * * The function msg_is_status() returns true (nonzero) if * the header class is an instance of status line * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function msg_is_xstatus() returns true (nonzero) if * the header object is an instance of header status and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int msg_is_status(msg_header_t const *header){ return header && header->sh_class->hc_hash == msg_status_hash;}#elseint msg_is_status(msg_header_t const *header);#endif#define msg_status_p(h) msg_is_status((h))/**Duplicate (deep copy) @c msg_status_t. * * The function msg_status_dup() duplicates a header * structure @a hdr. If the header structure @a hdr * contains a reference (@c hdr->x_next) to a list of * headers, all the headers in the list are duplicated, too. * * @param home memory home used to allocate new structure * @param hdr header structure to be duplicated * * When duplicating, all parameter lists and non-constant * strings attached to the header are copied, too. The * function uses given memory @a home to allocate all the * memory areas used to copy the header. * * @par Example * @code * * status = msg_status_dup(home, tst->msg_status); * * @endcode * * @return * The function msg_status_dup() returns a pointer to the * newly duplicated msg_status_t header structure, or NULL * upon an error. */msg_status_t *msg_status_dup(su_home_t *home, msg_status_t const *hdr);/**Copy a msg_status_t header structure. * * The function msg_status_copy() copies a header structure @a * hdr. If the header structure @a hdr contains a reference (@c * hdr->h_next) to a list of headers, all the headers in that * list are copied, too. The function uses given memory @a home * to allocate all the memory areas used to copy the header * structure @a hdr. * * @param home memory home used to allocate new structure * @param hdr pointer to the header structure to be duplicated * * When copying, only the header structure and parameter lists * attached to it are duplicated. The new header structure * retains all the references to the strings within the old @a * header, including the encoding of the old header, if present. * * @par Example * @code * * status = msg_status_copy(home, tst->msg_status); * * @endcode * * @return * The function msg_status_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */msg_status_t *msg_status_copy(su_home_t *home, msg_status_t const *hdr);/**Make a header structure msg_status_t. * * The function msg_status_make() makes a new * msg_status_t header structure. It allocates a new * header structure, and decodes the string @a s as the * value of the structure. * * @param home memory home used to allocate new header structure. * @param s string to be decoded as value of the new header structure * * @note This function is usually implemented as a macro calling * msg_header_make(). * * @return * The function msg_status_make() returns a pointer to * newly maked msg_status_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline msg_status_t *msg_status_make(su_home_t *home, char const *s){ return (msg_status_t *)msg_header_make(home, msg_status_class, s);}#elsemsg_status_t *msg_status_make(su_home_t *home, char const *s);#endif/**Make a status line from formatting result. * * The function msg_status_format() makes a new * status line object using formatting result as its * value. The function first prints the arguments according to * the format @a fmt specified. Then it allocates a new header * structure, and uses the formatting result as the header * value. * * @param home memory home used to allocate new header structure. * @param fmt string used as a printf()-style format * @param ... argument list for format * * @note This function is usually implemented as a macro calling * msg_header_format(). * * @return * The function msg_status_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifmsg_status_t *msg_status_format(su_home_t *home, char const *fmt, ...) __attribute__((__format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline msg_status_t *msg_status_format(su_home_t *home, char const *fmt, ...){ msg_header_t *h; va_list ap; va_start(ap, fmt); h = msg_header_vformat(home, msg_status_class, fmt, ap); va_end(ap); return (msg_status_t *)h;}#endif/** @} */SOFIA_END_DECLS#endif /* !defined(TEST_PROTOS_H) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -