File: tc.h

package info (click to toggle)
linuxptp 4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,664 kB
  • sloc: ansic: 28,366; sh: 178; makefile: 104
file content (103 lines) | stat: -rw-r--r-- 3,278 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
 * @file tc.h
 * @brief Provides Transparent Clock logic.
 * @note Copyright (C) 2018 Richard Cochran <richardcochran@gmail.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-1335 USA.
 */
#ifndef HAVE_TC_H
#define HAVE_TC_H

#include "msg.h"
#include "port_private.h"

/**
 * Flushes the list of remembered residence times.
 * @param q    Port whose list should be flushed
 */
void tc_flush(struct port *q);

/**
 * Forwards a given general message out all other ports.
 * @param q    The ingress port
 * @param msg  The message to be sent
 * @return     Zero on success, non-zero otherwise.
 */
int tc_forward(struct port *q, struct ptp_message *msg);

/**
 * Forwards a given Follow-Up message out all other ports.
 *
 * This function adds the unique, per egress port residence time into
 * the correction field for the transmitted follow up message.
 *
 * @param q    The ingress port
 * @param msg  The message to be sent
 * @return     Zero on success, non-zero otherwise.
 */
int tc_fwd_folup(struct port *q, struct ptp_message *msg);

/**
 * Forwards a given delay request message out all other ports.
 *
 * This function computes the unique residence time for each egress
 * port, remembering it in that egress port.
 *
 * @param q    The ingress port
 * @param msg  The message to be sent
 * @return     Zero on success, non-zero otherwise.
 */
int tc_fwd_request(struct port *q, struct ptp_message *msg);

/**
 * Forwards a given response message out all other ports.
 *
 * This function adds the unique, per egress port residence time into
 * the correction field for the transmitted delay response message.
 *
 * @param q    The ingress port
 * @param msg  The message to be sent
 * @return     Zero on success, non-zero otherwise.
 */
int tc_fwd_response(struct port *q, struct ptp_message *msg);

/**
 * Forwards a given sync message out all other ports.
 *
 * This function computes the unique residence time for each egress
 * port, remembering it in that egress port.
 *
 * @param q    The ingress port
 * @param msg  The message to be sent
 * @return     Zero on success, non-zero otherwise.
 */
int tc_fwd_sync(struct port *q, struct ptp_message *msg);

/**
 * Determines whether the local clock should ignore a given message.
 *
 * @param q    The ingress port
 * @param msg  The message to test
 * @return     One if the message should be ignored, zero otherwise.
 */
int tc_ignore(struct port *q, struct ptp_message *m);

/**
 * Prunes stale entries from the list of remembered residence times.
 * @param q    Port whose list should be pruned.
 */
void tc_prune(struct port *q);

#endif