/* * Copyright (c) 2023 joshua stein * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __FIDOPKT_H__ #define __FIDOPKT_H__ #include "util.h" struct fidopkt_address { u_int16_t zone; u_int16_t net; u_int16_t node; u_int16_t point; }; struct fidopkt_msgid { u_int32_t id; u_int16_t zone; u_int16_t net; u_int16_t node; u_int16_t point; }; struct fidopkt_header { struct fidopkt_address orig; struct fidopkt_address dest; }; struct fidopkt_message { struct fidopkt_header header; u_int16_t attr; #define FIDOPKT_MSG_ATTR_PRIVATE (1 << 0) #define FIDOPKT_MSG_ATTR_CRASH (1 << 1) time_t time; char to[36]; char from[36]; char subject[72]; char area[16]; char origin[72]; struct fidopkt_msgid msgid; char msgid_orig[64]; char reply[32]; char *body; size_t body_len; }; bool fidopkt_parse_address(char *str, struct fidopkt_address *address); struct fidopkt_message * fidopkt_parse_message(char *packet_filename, struct fidopkt_header *header, char **bufp, size_t *lenp); size_t fidopkt_encode_message(struct fidopkt_message *msg, char **bufp, char *pkt_password, short tzoff); void fidopkt_message_free(struct fidopkt_message **pktp); #endif