aboutsummaryrefslogtreecommitdiffstats
path: root/cms-socket-post/src/lib.rs
blob: 430a88a321e0b94f5f9f3dcbecc9c5971507a594 (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
// -*- 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-postd.sock";

#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum Msg {
    // Getters
    RunPostHandler {
        path: Ident,
        query: HashMap<String, Vec<u8>>,
        form_fields: HashMap<String, Vec<u8>>,
    },

    // Values
    PostHandlerResult {
        error: String,
        body: Vec<u8>,
        mime: String,
    },
}

impl_msg_serde!(Msg, 0x6ADCB73F);

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