]> git.ipfire.org Git - thirdparty/lldpd.git/blob - src/ctl.h
tests: fix skip instruction
[thirdparty/lldpd.git] / src / ctl.h
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
21 #if HAVE_CONFIG_H
22 # include <config.h>
23 #endif
24
25 #include <stdint.h>
26 #include "marshal.h"
27
28 enum hmsg_type {
29 NONE,
30 GET_CONFIG, /* Get global configuration */
31 SET_CONFIG, /* Change global configuration */
32 GET_INTERFACES, /* Get list of interfaces */
33 GET_CHASSIS, /* Get local chassis */
34 GET_INTERFACE, /* Get all information related to an interface */
35 GET_DEFAULT_PORT, /* Get all information related to default port */
36 SET_PORT, /* Set port-related information (location, power, policy) */
37 SUBSCRIBE, /* Subscribe to neighbor changes */
38 NOTIFICATION, /* Notification message (sent by lldpd!) */
39 };
40
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 */
47 struct hmsg_header {
48 enum hmsg_type type;
49 size_t len;
50 };
51 #define HMSG_MAX_SIZE (1<<19)
52
53 /* ctl.c */
54 int ctl_create(const char *);
55 int ctl_connect(const char *);
56 void ctl_cleanup(const char *);
57
58 int ctl_msg_send_unserialized(uint8_t **, size_t *,
59 enum hmsg_type,
60 void *, struct marshal_info *);
61 size_t ctl_msg_recv_unserialized(uint8_t **, size_t *,
62 enum hmsg_type,
63 void **, struct marshal_info *);
64
65 #endif