Blob


1 /*
2 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 /* 9p client library */
19 #ifndef NPCLIB_H
20 #define NPCLIB_H
22 #include "compat.h"
24 #include <stdint.h>
26 extern uint16_t iota_tag;
27 extern struct evbuffer *evb;
29 void write_hdr(uint32_t, uint8_t, uint16_t);
30 void write_hdr_auto(uint32_t, uint8_t);
31 void write_str(uint16_t, const char *);
32 void write_str_auto(const char *);
33 void write_buf(const void *, uint32_t);
34 void write_64(uint64_t);
35 void write_32(uint32_t);
36 void write_16(uint16_t);
37 void write_8(uint8_t);
39 #define write_off write_64
40 #define write_fid write_32
41 #define write_tag write_16
43 void tversion(const char *, uint32_t);
44 void tattach(uint32_t, uint32_t, const char *, const char *);
45 void tclunk(uint32_t);
46 void tflush(uint16_t);
47 void twalk(uint32_t, uint32_t, const char **, size_t);
48 void topen(uint32_t, uint8_t);
49 void tcreate(uint32_t, const char *, uint32_t, uint8_t);
50 void tread(uint32_t, uint64_t, uint32_t);
51 void twrite(uint32_t, uint64_t, const void *, uint32_t);
52 void tremove(uint32_t);
54 #endif