/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef RBP_H #define RBP_H #include typedef unsigned char rb_u8; typedef unsigned short rb_u16; #if defined(_WIN32) || defined(__WATCOMC__) typedef unsigned long rb_u32; #else #include #if ULONG_MAX == 0xffffffffUL typedef unsigned long rb_u32; #else typedef unsigned int rb_u32; #endif #endif enum {RB_HELLO=1,RB_AUTH,RB_READY,RB_NAV,RB_MOUSE,RB_KEY,RB_FRAME,RB_AUDIO,RB_STATUS,RB_ERROR,RB_RESIZE,RB_BACK,RB_FORWARD,RB_RELOAD,RB_STOP,RB_TEXT,RB_PING,RB_PONG}; typedef struct {void *ctx; int (*read)(void *,void *,unsigned int);int (*write)(void *,const void *,unsigned int);} rb_io; typedef struct {rb_u16 type; rb_u32 length, timestamp;} rb_header; rb_u16 rb_get16(const rb_u8 *p);rb_u32 rb_get32(const rb_u8 *p); void rb_put16(rb_u8 *p,rb_u16 n);void rb_put32(rb_u8 *p,rb_u32 n); int rb_read(rb_io *io,void *p,rb_u32 n);int rb_send(rb_io *io,rb_u16 type,const void *p,rb_u32 n);int rb_header_read(rb_io *io,rb_header *h);int rb_hello(rb_io *io,rb_u16 w,rb_u16 h,rb_u8 codecs,rb_u8 audio); int rb_rgb565(const rb_u8 *p,rb_u32 n,rb_u16 *dst,rb_u32 pixels,int rle); int rb_audio(const rb_u8 *p,rb_u32 n,short *dst,rb_u32 capacity); #endif