]> git.proxmox.com Git - mirror_frr.git/blob - lib/ptm_lib.h
Merge pull request #410 from dslicenc/rdnbrd-vrr
[mirror_frr.git] / lib / ptm_lib.h
1 /* PTM Library
2 * Copyright (C) 2015 Cumulus Networks, Inc.
3 *
4 * This file is part of Quagga.
5 *
6 * Quagga is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * Quagga is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Quagga; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
20 */
21 #ifndef __PTM_LIB_H__
22 #define __PTM_LIB_H__
23
24 #define PTMLIB_MSG_SZ 1024
25 #define PTMLIB_MSG_HDR_LEN 37
26 #define PTMLIB_MSG_VERSION 2
27 #define PTMLIB_MAXNAMELEN 32
28
29 #define PTMLIB_CMD_GET_STATUS "get-status"
30 #define PTMLIB_CMD_GET_BFD_CLIENT "get-bfd-client"
31 #define PTMLIB_CMD_START_BFD_SESS "start-bfd-sess"
32 #define PTMLIB_CMD_STOP_BFD_SESS "stop-bfd-sess"
33
34 typedef enum {
35 PTMLIB_MSG_TYPE_NOTIFICATION = 1,
36 PTMLIB_MSG_TYPE_CMD,
37 PTMLIB_MSG_TYPE_RESPONSE,
38 } ptmlib_msg_type;
39
40 typedef enum {
41 MODULE_BFD = 0,
42 MODULE_LLDP,
43 MODULE_MAX,
44 } ptmlib_mod_type;
45
46 typedef int (*ptm_cmd_cb) (void *data, void *arg);
47 typedef int (*ptm_notify_cb) (void *data, void *arg);
48 typedef int (*ptm_response_cb) (void *data, void *arg);
49 typedef int (*ptm_log_cb) (void *data, void *arg,...);
50
51 typedef struct ptm_lib_handle_s {
52 char client_name[PTMLIB_MAXNAMELEN];
53 ptm_cmd_cb cmd_cb;
54 ptm_notify_cb notify_cb;
55 ptm_response_cb response_cb;
56 } ptm_lib_handle_t;
57
58 /* Prototypes */
59 int ptm_lib_process_msg(ptm_lib_handle_t *, int, char *, int, void *);
60 ptm_lib_handle_t *ptm_lib_register(char *, ptm_cmd_cb, ptm_notify_cb, ptm_response_cb);
61 void ptm_lib_deregister(ptm_lib_handle_t *);
62 int ptm_lib_find_key_in_msg(void *, const char *, char *);
63 int ptm_lib_init_msg(ptm_lib_handle_t *, int, int, void *, void **);
64 int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, const char *);
65 int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *);
66
67 #endif