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 <stdint.h>
24 extern uint16_t iota_tag;
25 extern struct evbuffer *evb;
27 void write_hdr(uint32_t, uint8_t, uint16_t);
28 void write_hdr_auto(uint32_t, uint8_t);
29 void write_str(uint16_t, const char *);
30 void write_str_auto(const char *);
31 void write_buf(const void *, uint32_t);
32 void write_64(uint64_t);
33 void write_32(uint32_t);
34 void write_16(uint16_t);
35 void write_8(uint8_t);
37 #define write_off write_64
38 #define write_fid write_32
39 #define write_tag write_16
41 void tversion(const char *, uint32_t);
42 void tattach(uint32_t, uint32_t, const char *, const char *);
43 void tclunk(uint32_t);
44 void tflush(uint16_t);
45 void twalk(uint32_t, uint32_t, const char **, size_t);
46 void topen(uint32_t, uint8_t);
47 void tcreate(uint32_t, const char *, uint32_t, uint8_t);
48 void tread(uint32_t, uint64_t, uint32_t);
49 void twrite(uint32_t, uint64_t, const void *, uint32_t);
50 void tstat(uint32_t);
51 void twstat(uint32_t, const struct np_stat *);
52 void tremove(uint32_t);
54 #endif