2013-01-31 01:31:50 +08:00
|
|
|
/**
|
|
|
|
* @file pmc_common.h
|
|
|
|
* @brief Code shared between PTP management clients.
|
|
|
|
* @note Copyright (C) 2013 Miroslav Lichvar <mlichvar@redhat.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_PMC_COMMON_H
|
|
|
|
#define HAVE_PMC_COMMON_H
|
|
|
|
|
2015-08-11 02:29:51 +08:00
|
|
|
#include "config.h"
|
2020-08-30 06:37:51 +08:00
|
|
|
#include "fsm.h"
|
2013-01-31 01:31:50 +08:00
|
|
|
#include "msg.h"
|
2014-04-11 18:25:53 +08:00
|
|
|
#include "transport.h"
|
2013-01-31 01:31:50 +08:00
|
|
|
|
|
|
|
struct pmc;
|
|
|
|
|
2015-08-11 02:29:51 +08:00
|
|
|
struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
|
|
|
|
const char *iface_name, UInteger8 boundary_hops,
|
|
|
|
UInteger8 domain_number, UInteger8 transport_specific,
|
|
|
|
int zero_datalen);
|
2013-01-31 01:31:50 +08:00
|
|
|
|
|
|
|
void pmc_destroy(struct pmc *pmc);
|
|
|
|
|
|
|
|
int pmc_get_transport_fd(struct pmc *pmc);
|
|
|
|
|
2013-02-09 10:22:06 +08:00
|
|
|
int pmc_send_get_action(struct pmc *pmc, int id);
|
2013-01-31 01:31:50 +08:00
|
|
|
|
2013-07-06 19:44:51 +08:00
|
|
|
int pmc_send_set_action(struct pmc *pmc, int id, void *data, int datasize);
|
|
|
|
|
2013-01-31 01:31:50 +08:00
|
|
|
struct ptp_message *pmc_recv(struct pmc *pmc);
|
|
|
|
|
2013-07-22 12:35:45 +08:00
|
|
|
int pmc_target(struct pmc *pmc, struct PortIdentity *pid);
|
2014-06-12 03:35:18 +08:00
|
|
|
void pmc_target_port(struct pmc *pmc, UInteger16 portNumber);
|
|
|
|
void pmc_target_all(struct pmc *pmc);
|
2013-07-22 12:35:45 +08:00
|
|
|
|
2018-06-18 18:21:38 +08:00
|
|
|
const char *pmc_action_string(int action);
|
|
|
|
int pmc_do_command(struct pmc *pmc, char *str);
|
|
|
|
|
2020-08-30 06:37:51 +08:00
|
|
|
struct pmc_node;
|
|
|
|
|
|
|
|
typedef int pmc_node_recv_subscribed_t(struct pmc_node *node,
|
|
|
|
struct ptp_message *msg,
|
|
|
|
int excluded);
|
|
|
|
|
|
|
|
struct pmc_node {
|
|
|
|
struct pmc *pmc;
|
|
|
|
int pmc_ds_requested;
|
|
|
|
uint64_t pmc_last_update;
|
|
|
|
int sync_offset;
|
|
|
|
int leap;
|
|
|
|
int utc_offset_traceable;
|
|
|
|
int clock_identity_set;
|
|
|
|
struct ClockIdentity clock_identity;
|
|
|
|
pmc_node_recv_subscribed_t *recv_subscribed;
|
|
|
|
};
|
|
|
|
|
|
|
|
int init_pmc_node(struct config *cfg, struct pmc_node *node, const char *uds,
|
|
|
|
pmc_node_recv_subscribed_t *recv_subscribed);
|
|
|
|
void close_pmc_node(struct pmc_node *node);
|
|
|
|
int update_pmc_node(struct pmc_node *node, int subscribe);
|
|
|
|
int run_pmc_subscribe(struct pmc_node *node, int timeout);
|
|
|
|
int run_pmc_clock_identity(struct pmc_node *node, int timeout);
|
|
|
|
int run_pmc_wait_sync(struct pmc_node *node, int timeout);
|
|
|
|
int run_pmc_get_number_ports(struct pmc_node *node, int timeout);
|
|
|
|
void run_pmc_events(struct pmc_node *node);
|
|
|
|
int run_pmc_port_properties(struct pmc_node *node, int timeout,
|
|
|
|
unsigned int port, int *state,
|
|
|
|
int *tstamping, char *iface);
|
|
|
|
int run_pmc_get_utc_offset(struct pmc_node *node, int timeout);
|
|
|
|
int get_mgt_id(struct ptp_message *msg);
|
|
|
|
void *get_mgt_data(struct ptp_message *msg);
|
|
|
|
|
2013-01-31 01:31:50 +08:00
|
|
|
#endif
|