1 /** 2 * Copyright (c) 2021, Timothy Stack 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * * Redistributions of source code must retain the above copyright notice, this 10 * list of conditions and the following disclaimer. 11 * * Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * * Neither the name of Timothy Stack nor the names of its contributors 15 * may be used to endorse or promote products derived from this software 16 * without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #ifndef lnav_tailer_h 31 #define lnav_tailer_h 32 33 #ifndef __COSMOPOLITAN__ 34 #include <sys/types.h> 35 #endif 36 37 typedef enum { 38 TPPT_DONE, 39 TPPT_STRING, 40 TPPT_HASH, 41 TPPT_INT64, 42 TPPT_BITS, 43 } tailer_packet_payload_type_t; 44 45 typedef enum { 46 TPT_ERROR, 47 TPT_OPEN_PATH, 48 TPT_CLOSE_PATH, 49 TPT_OFFER_BLOCK, 50 TPT_NEED_BLOCK, 51 TPT_ACK_BLOCK, 52 TPT_TAIL_BLOCK, 53 TPT_LINK_BLOCK, 54 TPT_SYNCED, 55 TPT_LOG, 56 TPT_LOAD_PREVIEW, 57 TPT_PREVIEW_ERROR, 58 TPT_PREVIEW_DATA, 59 TPT_COMPLETE_PATH, 60 TPT_POSSIBLE_PATH, 61 TPT_ANNOUNCE, 62 } tailer_packet_type_t; 63 64 #ifdef __cplusplus 65 extern "C" { 66 #endif 67 68 ssize_t send_packet(int fd, 69 tailer_packet_type_t tpt, 70 tailer_packet_payload_type_t payload_type, 71 ...); 72 73 #ifdef __cplusplus 74 }; 75 #endif 76 77 #endif 78