Blame unicast_service.h

Packit Service d8d8ac
/**
Packit Service d8d8ac
 * @file unicast_service.h
Packit Service d8d8ac
 * @brief Unicast service
Packit Service d8d8ac
 * @note Copyright (C) 2018 Richard Cochran <richardcochran@gmail.com>
Packit Service d8d8ac
 *
Packit Service d8d8ac
 * This program is free software; you can redistribute it and/or modify
Packit Service d8d8ac
 * it under the terms of the GNU General Public License as published by
Packit Service d8d8ac
 * the Free Software Foundation; either version 2 of the License, or
Packit Service d8d8ac
 * (at your option) any later version.
Packit Service d8d8ac
 *
Packit Service d8d8ac
 * This program is distributed in the hope that it will be useful,
Packit Service d8d8ac
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service d8d8ac
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service d8d8ac
 * GNU General Public License for more details.
Packit Service d8d8ac
 *
Packit Service d8d8ac
 * You should have received a copy of the GNU General Public License along
Packit Service d8d8ac
 * with this program; if not, write to the Free Software Foundation, Inc.,
Packit Service d8d8ac
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA.
Packit Service d8d8ac
 */
Packit Service d8d8ac
#ifndef HAVE_UNICAST_SERVICE_H
Packit Service d8d8ac
#define HAVE_UNICAST_SERVICE_H
Packit Service d8d8ac
Packit Service d8d8ac
struct port;
Packit Service d8d8ac
struct ptp_message;
Packit Service d8d8ac
struct tlv_extra;
Packit Service d8d8ac
Packit Service d8d8ac
#define SERVICE_GRANTED   0
Packit Service d8d8ac
#define SERVICE_DENIED    1
Packit Service d8d8ac
#define SERVICE_DISABLED  2
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Handle a request for unicast service.
Packit Service d8d8ac
 * @param p      The port on which the signaling message was received.
Packit Service d8d8ac
 * @param m      The signaling message containing the request.
Packit Service d8d8ac
 * @param extra  The TLV containing the request.
Packit Service d8d8ac
 * @return       SERVICE_GRANTED, SERVICE_DENIED, or SERVICE_DISABLED.
Packit Service d8d8ac
 */
Packit Service d8d8ac
int unicast_service_add(struct port *p, struct ptp_message *m,
Packit Service d8d8ac
			struct tlv_extra *extra);
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Frees all of the resources associated with a port's unicast service.
Packit Service d8d8ac
 * @param p      The port in question.
Packit Service d8d8ac
 */
Packit Service d8d8ac
void unicast_service_cleanup(struct port *p);
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Responds to a unicast service request with a denial.
Packit Service d8d8ac
 * @param p      The port on which the signaling message was received.
Packit Service d8d8ac
 * @param m      The signaling message containing the request.
Packit Service d8d8ac
 * @param extra  The TLV containing the request.
Packit Service d8d8ac
 * @return       Zero on success, non-zero otherwise.
Packit Service d8d8ac
 */
Packit Service d8d8ac
int unicast_service_deny(struct port *p, struct ptp_message *m,
Packit Service d8d8ac
			 struct tlv_extra *extra);
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Responds to a unicast service request with a grant.
Packit Service d8d8ac
 * @param p      The port on which the signaling message was received.
Packit Service d8d8ac
 * @param m      The signaling message containing the request.
Packit Service d8d8ac
 * @param extra  The TLV containing the request.
Packit Service d8d8ac
 * @return       Zero on success, non-zero otherwise.
Packit Service d8d8ac
 */
Packit Service d8d8ac
int unicast_service_grant(struct port *p, struct ptp_message *m,
Packit Service d8d8ac
			  struct tlv_extra *extra);
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Initializes unicast service on a given port.
Packit Service d8d8ac
 * @param p      The port in question.
Packit Service d8d8ac
 * @return       Zero on success, non-zero otherwise.
Packit Service d8d8ac
 */
Packit Service d8d8ac
int unicast_service_initialize(struct port *p);
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Handle a unicast service cancellation.
Packit Service d8d8ac
 * @param p      The port on which the signaling message was received.
Packit Service d8d8ac
 * @param m      The signaling message containing the cancellation.
Packit Service d8d8ac
 * @param extra  The TLV containing the cancellation.
Packit Service d8d8ac
 */
Packit Service d8d8ac
void unicast_service_remove(struct port *p, struct ptp_message *m,
Packit Service d8d8ac
			    struct tlv_extra *extra);
Packit Service d8d8ac
Packit Service d8d8ac
/**
Packit Service d8d8ac
 * Handles the unicast service timer, sending messages according to schedule.
Packit Service d8d8ac
 * @param p      The port in question.
Packit Service d8d8ac
 * @return       Zero on success, non-zero otherwise.
Packit Service d8d8ac
 */
Packit Service d8d8ac
int unicast_service_timer(struct port *p);
Packit Service d8d8ac
Packit Service d8d8ac
#endif