]> git.ipfire.org Git - thirdparty/lldpd.git/blame - src/ctl.h
tests: fix skip instruction
[thirdparty/lldpd.git] / src / ctl.h
CommitLineData
4b292b55
VB
1/* -*- mode: c; c-file-style: "openbsd" -*- */
2/*
3 * Copyright (c) 2012 Vincent Bernat <bernat@luffy.cx>
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _CTL_H
19#define _CTL_H
20
c3e340b6
VB
21#if HAVE_CONFIG_H
22# include <config.h>
23#endif
24
4b292b55
VB
25#include <stdint.h>
26#include "marshal.h"
27
28enum hmsg_type {
29 NONE,
8729d69f 30 GET_CONFIG, /* Get global configuration */
47287a61 31 SET_CONFIG, /* Change global configuration */
4b292b55 32 GET_INTERFACES, /* Get list of interfaces */
99ef55d3 33 GET_CHASSIS, /* Get local chassis */
4b292b55 34 GET_INTERFACE, /* Get all information related to an interface */
9da663f7 35 GET_DEFAULT_PORT, /* Get all information related to default port */
4b292b55 36 SET_PORT, /* Set port-related information (location, power, policy) */
4e90a9e0
VB
37 SUBSCRIBE, /* Subscribe to neighbor changes */
38 NOTIFICATION, /* Notification message (sent by lldpd!) */
4b292b55
VB
39};
40
e0478a46
VB
41/** Header for the control protocol.
42 *
43 * The protocol is pretty simple. We send a single message containing the
44 * provided message type with the message length, followed by the message
45 * content.
46 */
47struct hmsg_header {
48 enum hmsg_type type;
49 size_t len;
50};
82374540 51#define HMSG_MAX_SIZE (1<<19)
e0478a46 52
4b292b55 53/* ctl.c */
0262adbb
ZM
54int ctl_create(const char *);
55int ctl_connect(const char *);
56void ctl_cleanup(const char *);
4b292b55
VB
57
58int ctl_msg_send_unserialized(uint8_t **, size_t *,
59 enum hmsg_type,
60 void *, struct marshal_info *);
61size_t ctl_msg_recv_unserialized(uint8_t **, size_t *,
62 enum hmsg_type,
63 void **, struct marshal_info *);
64
65#endif