File: unicast_service.h

package info (click to toggle)
linuxptp 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,536 kB
  • sloc: ansic: 26,119; sh: 92; makefile: 87
file content (90 lines) | stat: -rw-r--r-- 3,179 bytes parent folder | download | duplicates (3)
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
/**
 * @file unicast_service.h
 * @brief Unicast service
 * @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_UNICAST_SERVICE_H
#define HAVE_UNICAST_SERVICE_H

struct port;
struct ptp_message;
struct tlv_extra;

#define SERVICE_GRANTED   0
#define SERVICE_DENIED    1
#define SERVICE_DISABLED  2

/**
 * Handle a request for unicast service.
 * @param p      The port on which the signaling message was received.
 * @param m      The signaling message containing the request.
 * @param extra  The TLV containing the request.
 * @return       SERVICE_GRANTED, SERVICE_DENIED, or SERVICE_DISABLED.
 */
int unicast_service_add(struct port *p, struct ptp_message *m,
			struct tlv_extra *extra);

/**
 * Frees all of the resources associated with a port's unicast service.
 * @param p      The port in question.
 */
void unicast_service_cleanup(struct port *p);

/**
 * Responds to a unicast service request with a denial.
 * @param p      The port on which the signaling message was received.
 * @param m      The signaling message containing the request.
 * @param extra  The TLV containing the request.
 * @return       Zero on success, non-zero otherwise.
 */
int unicast_service_deny(struct port *p, struct ptp_message *m,
			 struct tlv_extra *extra);

/**
 * Responds to a unicast service request with a grant.
 * @param p      The port on which the signaling message was received.
 * @param m      The signaling message containing the request.
 * @param extra  The TLV containing the request.
 * @return       Zero on success, non-zero otherwise.
 */
int unicast_service_grant(struct port *p, struct ptp_message *m,
			  struct tlv_extra *extra);

/**
 * Initializes unicast service on a given port.
 * @param p      The port in question.
 * @return       Zero on success, non-zero otherwise.
 */
int unicast_service_initialize(struct port *p);

/**
 * Handle a unicast service cancellation.
 * @param p      The port on which the signaling message was received.
 * @param m      The signaling message containing the cancellation.
 * @param extra  The TLV containing the cancellation.
 */
void unicast_service_remove(struct port *p, struct ptp_message *m,
			    struct tlv_extra *extra);

/**
 * Handles the unicast service timer, sending messages according to schedule.
 * @param p      The port in question.
 * @return       Zero on success, non-zero otherwise.
 */
int unicast_service_timer(struct port *p);

#endif