Blame tc.h

Packit 9c3e7e
/**
Packit 9c3e7e
 * @file tc.h
Packit 9c3e7e
 * @brief Provides Transparent Clock logic.
Packit 9c3e7e
 * @note Copyright (C) 2018 Richard Cochran <richardcochran@gmail.com>
Packit 9c3e7e
 *
Packit 9c3e7e
 * This program is free software; you can redistribute it and/or modify
Packit 9c3e7e
 * it under the terms of the GNU General Public License as published by
Packit 9c3e7e
 * the Free Software Foundation; either version 2 of the License, or
Packit 9c3e7e
 * (at your option) any later version.
Packit 9c3e7e
 *
Packit 9c3e7e
 * This program is distributed in the hope that it will be useful,
Packit 9c3e7e
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 9c3e7e
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 9c3e7e
 * GNU General Public License for more details.
Packit 9c3e7e
 *
Packit 9c3e7e
 * You should have received a copy of the GNU General Public License along
Packit 9c3e7e
 * with this program; if not, write to the Free Software Foundation, Inc.,
Packit 9c3e7e
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA.
Packit 9c3e7e
 */
Packit 9c3e7e
#ifndef HAVE_TC_H
Packit 9c3e7e
#define HAVE_TC_H
Packit 9c3e7e
Packit 9c3e7e
#include "msg.h"
Packit 9c3e7e
#include "port_private.h"
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Flushes the list of remembered residence times.
Packit 9c3e7e
 * @param q    Port whose list should be flushed
Packit 9c3e7e
 */
Packit 9c3e7e
void tc_flush(struct port *q);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Forwards a given general message out all other ports.
Packit 9c3e7e
 * @param q    The ingress port
Packit 9c3e7e
 * @param msg  The message to be sent
Packit 9c3e7e
 * @return     Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int tc_forward(struct port *q, struct ptp_message *msg);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Forwards a given Follow-Up message out all other ports.
Packit 9c3e7e
 *
Packit 9c3e7e
 * This function adds the unique, per egress port residence time into
Packit 9c3e7e
 * the correction field for the transmitted follow up message.
Packit 9c3e7e
 *
Packit 9c3e7e
 * @param q    The ingress port
Packit 9c3e7e
 * @param msg  The message to be sent
Packit 9c3e7e
 * @return     Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int tc_fwd_folup(struct port *q, struct ptp_message *msg);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Forwards a given delay request message out all other ports.
Packit 9c3e7e
 *
Packit 9c3e7e
 * This function computes the unique residence time for each egress
Packit 9c3e7e
 * port, remembering it in that egress port.
Packit 9c3e7e
 *
Packit 9c3e7e
 * @param q    The ingress port
Packit 9c3e7e
 * @param msg  The message to be sent
Packit 9c3e7e
 * @return     Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int tc_fwd_request(struct port *q, struct ptp_message *msg);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Forwards a given response message out all other ports.
Packit 9c3e7e
 *
Packit 9c3e7e
 * This function adds the unique, per egress port residence time into
Packit 9c3e7e
 * the correction field for the transmitted delay response message.
Packit 9c3e7e
 *
Packit 9c3e7e
 * @param q    The ingress port
Packit 9c3e7e
 * @param msg  The message to be sent
Packit 9c3e7e
 * @return     Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int tc_fwd_response(struct port *q, struct ptp_message *msg);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Forwards a given sync message out all other ports.
Packit 9c3e7e
 *
Packit 9c3e7e
 * This function computes the unique residence time for each egress
Packit 9c3e7e
 * port, remembering it in that egress port.
Packit 9c3e7e
 *
Packit 9c3e7e
 * @param q    The ingress port
Packit 9c3e7e
 * @param msg  The message to be sent
Packit 9c3e7e
 * @return     Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int tc_fwd_sync(struct port *q, struct ptp_message *msg);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Determines whether the local clock should ignore a given message.
Packit 9c3e7e
 *
Packit 9c3e7e
 * @param q    The ingress port
Packit 9c3e7e
 * @param msg  The message to test
Packit 9c3e7e
 * @return     One if the message should be ignored, zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int tc_ignore(struct port *q, struct ptp_message *m);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Prunes stale entries from the list of remembered residence times.
Packit 9c3e7e
 * @param q    Port whose list should be pruned.
Packit 9c3e7e
 */
Packit 9c3e7e
void tc_prune(struct port *q);
Packit 9c3e7e
Packit 9c3e7e
#endif