aboutsummaryrefslogtreecommitdiffstats
path: root/cms-socket-db/src/lib.rs
blob: ef91ed4aadc5128e7db68f95ef0f96c0a0fbfbad (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// -*- 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};

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

#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum Msg {
    // Getters
    GetPage {
        path: Ident,
        get_title: bool,
        get_data: bool,
        get_stamp: bool,
        get_prio: bool, //TODO remove this
        get_redirect: bool,
        get_nav_stop: bool,  //TODO move this to GetSubPages
        get_nav_label: bool, //TODO remove this
    },
    GetHeaders {
        path: Ident,
    },
    GetSubPages {
        path: Ident,
    },
    GetMacro {
        parent: Ident,
        name: Ident,
    },
    GetString {
        name: Ident,
    },
    GetImage {
        name: Ident,
    },

    // Values
    Page {
        title: Option<Vec<u8>>,
        data: Option<Vec<u8>>,
        stamp: Option<u64>,
        prio: Option<u64>,
        redirect: Option<Vec<u8>>,
        nav_stop: Option<bool>,
        nav_label: Option<Vec<u8>>,
    },
    Headers {
        data: Vec<u8>,
    },
    SubPages {
        names: Vec<Vec<u8>>,
        nav_labels: Vec<Vec<u8>>,
        prios: Vec<u64>,
    },
    Macro {
        data: Vec<u8>,
    },
    String {
        data: Vec<u8>,
    },
    Image {
        data: Vec<u8>,
    },
}

impl_msg_serde!(Msg, 0x8F5755D6);

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