summaryrefslogtreecommitdiff
path: root/net.h
diff options
context:
space:
mode:
authorwrmr2024-11-03 12:49:38 -0500
committerwrmr2024-11-03 12:49:38 -0500
commit9faead33740e7b5b847478518fd3a270a2aa5c2a (patch)
treedcf3b0e397bcec261341c598a20621c52b13ef87 /net.h
parentce088cbf9c3a73e9f9ed3012d31dd6e989d86052 (diff)
some refactoring to disconnect doc_type from networking
Diffstat (limited to 'net.h')
-rw-r--r--net.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/net.h b/net.h
index c3e12ef..64048be 100644
--- a/net.h
+++ b/net.h
@@ -2,9 +2,10 @@
#define NET_H
#include "buf.h"
+#include "doc.h"
-#define HOST_MAX 256
-#define PATH_MAX 256
+#define HOST_MAX 255
+#define PATH_MAX 255
enum protocol {
PROT_UNKNOWN,
@@ -13,22 +14,14 @@ enum protocol {
PROT_GEMINI,
};
-enum doc_type {
- DOC_UNKNOWN,
- DOC_GOPHERDOC,
- DOC_GEMTEXT,
- DOC_PLAIN,
-};
-
struct addr {
- char host[HOST_MAX];
- char path[PATH_MAX];
+ char host[HOST_MAX + 1];
+ char path[PATH_MAX + 1];
size_t host_len, path_len;
enum protocol prot;
- enum doc_type type;
};
int net_addr(const char *url, struct addr *adr, enum protocol prot_default);
-int net_fetch(const struct addr *adr, struct buf *buf);
+int net_fetch(const struct addr *adr, struct buf *buf, enum doc_type *doct);
#endif