1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2015 Cumulus Networks, Inc.
12 #define PTMLIB_MSG_SZ 1024
13 #define PTMLIB_MSG_HDR_LEN 37
14 #define PTMLIB_MSG_VERSION 2
15 #define PTMLIB_MAXNAMELEN 32
17 #define PTMLIB_CMD_GET_STATUS "get-status"
18 #define PTMLIB_CMD_GET_BFD_CLIENT "get-bfd-client"
19 #define PTMLIB_CMD_START_BFD_SESS "start-bfd-sess"
20 #define PTMLIB_CMD_STOP_BFD_SESS "stop-bfd-sess"
23 PTMLIB_MSG_TYPE_NOTIFICATION
= 1,
25 PTMLIB_MSG_TYPE_RESPONSE
,
34 typedef int (*ptm_cmd_cb
)(void *data
, void *arg
);
35 typedef int (*ptm_notify_cb
)(void *data
, void *arg
);
36 typedef int (*ptm_response_cb
)(void *data
, void *arg
);
37 typedef int (*ptm_log_cb
)(void *data
, void *arg
, ...);
39 typedef struct ptm_lib_handle_s
{
40 char client_name
[PTMLIB_MAXNAMELEN
];
42 ptm_notify_cb notify_cb
;
43 ptm_response_cb response_cb
;
47 int ptm_lib_process_msg(ptm_lib_handle_t
*, int, char *, int, void *);
48 ptm_lib_handle_t
*ptm_lib_register(char *, ptm_cmd_cb
, ptm_notify_cb
,
50 void ptm_lib_deregister(ptm_lib_handle_t
*);
51 int ptm_lib_find_key_in_msg(void *, const char *, char *);
52 int ptm_lib_init_msg(ptm_lib_handle_t
*, int, int, void *, void **);
53 int ptm_lib_append_msg(ptm_lib_handle_t
*, void *, const char *, const char *);
54 int ptm_lib_complete_msg(ptm_lib_handle_t
*, void *, char *, int *);
55 int ptm_lib_cleanup_msg(ptm_lib_handle_t
*, void *);