Download
jcs
/subtext
/fidopkt.h
(View History)
jcs fidopkt: A single packet can have multiple messages in it | Latest amendment: 402 on 2023-03-13 |
1 | /* |
2 | * Copyright (c) 2023 joshua stein <jcs@jcs.org> |
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 | */ |
16 | |
17 | #ifndef __FIDOPKT_H__ |
18 | #define __FIDOPKT_H__ |
19 | |
20 | #include "util.h" |
21 | |
22 | struct fidopkt_address { |
23 | u_int16_t zone; |
24 | u_int16_t net; |
25 | u_int16_t node; |
26 | u_int16_t point; |
27 | }; |
28 | |
29 | struct fidopkt_msgid { |
30 | u_int32_t id; |
31 | u_int16_t zone; |
32 | u_int16_t net; |
33 | u_int16_t node; |
34 | u_int16_t point; |
35 | }; |
36 | |
37 | struct fidopkt_header { |
38 | struct fidopkt_address orig; |
39 | struct fidopkt_address dest; |
40 | }; |
41 | struct fidopkt_message { |
42 | struct fidopkt_header header; |
43 | u_int16_t attr; |
44 | #define FIDOPKT_MSG_ATTR_PRIVATE (1 << 0) |
45 | #define FIDOPKT_MSG_ATTR_CRASH (1 << 1) |
46 | time_t time; |
47 | char to[36]; |
48 | char from[36]; |
49 | char subject[72]; |
50 | char area[16]; |
51 | char origin[72]; |
52 | struct fidopkt_msgid msgid; |
53 | char msgid_orig[64]; |
54 | char reply[32]; |
55 | char *body; |
56 | size_t body_len; |
57 | }; |
58 | |
59 | bool fidopkt_parse_address(char *str, struct fidopkt_address *address); |
60 | struct fidopkt_message * fidopkt_parse_message(char *packet_filename, |
61 | struct fidopkt_header *header, char **bufp, size_t *lenp); |
62 | size_t fidopkt_encode_message(struct fidopkt_message *msg, char **bufp, |
63 | char *pkt_password, short tzoff); |
64 | void fidopkt_message_free(struct fidopkt_message **pktp); |
65 | |
66 | #endif |