GuoWenxue
2022-04-29 8bdd4bb9f08e38b61b47caa5aa50d6912772b289
apue/project_socket/src/packet.h
@@ -54,6 +54,17 @@
 *               $size     :  packet output buffer size
 * return value: <0: failure   >0: packet bytes
 */
extern int packet_string_pack(pack_info_t *pack_info, char *pack_buf, int size);
extern int packet_segmented_pack(pack_info_t *pack_info, char *pack_buf, int size);
/*  description: package a json string packet: {"devid":"xxx", "time":"xxx", "temperature":"xxx"}
 *   input args:
 *               $pack_info:  packet data contains devid, time and temperature
 *               $pack_buf :  packet output buffer
 *               $size     :  packet output buffer size
 * return value: <0: failure   >0: packet bytes
 */
extern int packet_json_pack(pack_info_t *pack_info, char *pack_buf, int size);
#endif   /* ----- #ifndef _PACKET_H_  ----- */