aboutsummaryrefslogtreecommitdiffstats
path: root/cms-socket-back/src/lib.rs
blob: 2256d32af8e7a16a1d211c2b40fa6fecbd009529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- coding: utf-8 -*-
//
// Simple CMS
//
// Copyright (C) 2011-2024 Michael Büsch <m@bues.ch>
//
// Licensed under the Apache License version 2.0
// or the MIT license, at your option.
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![forbid(unsafe_code)]

use cms_ident::Ident;
use cms_socket::impl_msg_serde;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

pub const SOCK_FILE: &str = "cms-backd.sock";

#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum Msg {
    Get {
        host: String,
        path: Ident,
        https: bool,
        cookie: Vec<u8>,
        query: HashMap<String, Vec<u8>>,
    },
    Post {
        host: String,
        path: Ident,
        https: bool,
        cookie: Vec<u8>,
        query: HashMap<String, Vec<u8>>,
        body: Vec<u8>,
        body_mime: String,
    },
    Reply {
        status: u32,
        body: Vec<u8>,
        mime: String,
        extra_headers: Vec<String>,
    },
}

impl_msg_serde!(Msg, 0x9C66EA74);

// vim: ts=4 sw=4 expandtab
bues.ch cgit interface