]>
Commit | Line | Data |
---|---|---|
50e24903 DS |
1 | /* PTM Library |
2 | * Copyright (C) 2015 Cumulus Networks, Inc. | |
c43ed2e4 | 3 | * |
50e24903 | 4 | * This file is part of Quagga. |
c43ed2e4 | 5 | * |
50e24903 DS |
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 | * | |
896014f4 DL |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
c43ed2e4 | 19 | */ |
50e24903 DS |
20 | #ifndef __PTM_LIB_H__ |
21 | #define __PTM_LIB_H__ | |
c43ed2e4 | 22 | |
5e244469 RW |
23 | #ifdef __cplusplus |
24 | extern "C" { | |
25 | #endif | |
26 | ||
c43ed2e4 DS |
27 | #define PTMLIB_MSG_SZ 1024 |
28 | #define PTMLIB_MSG_HDR_LEN 37 | |
29 | #define PTMLIB_MSG_VERSION 2 | |
30 | #define PTMLIB_MAXNAMELEN 32 | |
31 | ||
32 | #define PTMLIB_CMD_GET_STATUS "get-status" | |
33 | #define PTMLIB_CMD_GET_BFD_CLIENT "get-bfd-client" | |
34 | #define PTMLIB_CMD_START_BFD_SESS "start-bfd-sess" | |
35 | #define PTMLIB_CMD_STOP_BFD_SESS "stop-bfd-sess" | |
36 | ||
37 | typedef enum { | |
d62a17ae | 38 | PTMLIB_MSG_TYPE_NOTIFICATION = 1, |
39 | PTMLIB_MSG_TYPE_CMD, | |
40 | PTMLIB_MSG_TYPE_RESPONSE, | |
c43ed2e4 DS |
41 | } ptmlib_msg_type; |
42 | ||
43 | typedef enum { | |
d62a17ae | 44 | MODULE_BFD = 0, |
45 | MODULE_LLDP, | |
46 | MODULE_MAX, | |
c43ed2e4 DS |
47 | } ptmlib_mod_type; |
48 | ||
d62a17ae | 49 | typedef int (*ptm_cmd_cb)(void *data, void *arg); |
50 | typedef int (*ptm_notify_cb)(void *data, void *arg); | |
51 | typedef int (*ptm_response_cb)(void *data, void *arg); | |
52 | typedef int (*ptm_log_cb)(void *data, void *arg, ...); | |
c43ed2e4 DS |
53 | |
54 | typedef struct ptm_lib_handle_s { | |
d62a17ae | 55 | char client_name[PTMLIB_MAXNAMELEN]; |
56 | ptm_cmd_cb cmd_cb; | |
57 | ptm_notify_cb notify_cb; | |
58 | ptm_response_cb response_cb; | |
c43ed2e4 DS |
59 | } ptm_lib_handle_t; |
60 | ||
61 | /* Prototypes */ | |
62 | int ptm_lib_process_msg(ptm_lib_handle_t *, int, char *, int, void *); | |
d62a17ae | 63 | ptm_lib_handle_t *ptm_lib_register(char *, ptm_cmd_cb, ptm_notify_cb, |
64 | ptm_response_cb); | |
c43ed2e4 DS |
65 | void ptm_lib_deregister(ptm_lib_handle_t *); |
66 | int ptm_lib_find_key_in_msg(void *, const char *, char *); | |
67 | int ptm_lib_init_msg(ptm_lib_handle_t *, int, int, void *, void **); | |
88177fe3 | 68 | int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, const char *); |
c43ed2e4 | 69 | int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *); |
b5f270ad | 70 | int ptm_lib_cleanup_msg(ptm_lib_handle_t *, void *); |
50e24903 | 71 | |
5e244469 RW |
72 | #ifdef __cplusplus |
73 | } | |
74 | #endif | |
75 | ||
50e24903 | 76 | #endif |