Blame unicast_service.h

Packit 9c3e7e
/**
Packit 9c3e7e
 * @file unicast_service.h
Packit 9c3e7e
 * @brief Unicast service
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_UNICAST_SERVICE_H
Packit 9c3e7e
#define HAVE_UNICAST_SERVICE_H
Packit 9c3e7e
Packit 9c3e7e
struct port;
Packit 9c3e7e
struct ptp_message;
Packit 9c3e7e
struct tlv_extra;
Packit 9c3e7e
Packit 9c3e7e
#define SERVICE_GRANTED   0
Packit 9c3e7e
#define SERVICE_DENIED    1
Packit 9c3e7e
#define SERVICE_DISABLED  2
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Handle a request for unicast service.
Packit 9c3e7e
 * @param p      The port on which the signaling message was received.
Packit 9c3e7e
 * @param m      The signaling message containing the request.
Packit 9c3e7e
 * @param extra  The TLV containing the request.
Packit 9c3e7e
 * @return       SERVICE_GRANTED, SERVICE_DENIED, or SERVICE_DISABLED.
Packit 9c3e7e
 */
Packit 9c3e7e
int unicast_service_add(struct port *p, struct ptp_message *m,
Packit 9c3e7e
			struct tlv_extra *extra);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Frees all of the resources associated with a port's unicast service.
Packit 9c3e7e
 * @param p      The port in question.
Packit 9c3e7e
 */
Packit 9c3e7e
void unicast_service_cleanup(struct port *p);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Responds to a unicast service request with a denial.
Packit 9c3e7e
 * @param p      The port on which the signaling message was received.
Packit 9c3e7e
 * @param m      The signaling message containing the request.
Packit 9c3e7e
 * @param extra  The TLV containing the request.
Packit 9c3e7e
 * @return       Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int unicast_service_deny(struct port *p, struct ptp_message *m,
Packit 9c3e7e
			 struct tlv_extra *extra);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Responds to a unicast service request with a grant.
Packit 9c3e7e
 * @param p      The port on which the signaling message was received.
Packit 9c3e7e
 * @param m      The signaling message containing the request.
Packit 9c3e7e
 * @param extra  The TLV containing the request.
Packit 9c3e7e
 * @return       Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int unicast_service_grant(struct port *p, struct ptp_message *m,
Packit 9c3e7e
			  struct tlv_extra *extra);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Initializes unicast service on a given port.
Packit 9c3e7e
 * @param p      The port in question.
Packit 9c3e7e
 * @return       Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int unicast_service_initialize(struct port *p);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Handle a unicast service cancellation.
Packit 9c3e7e
 * @param p      The port on which the signaling message was received.
Packit 9c3e7e
 * @param m      The signaling message containing the cancellation.
Packit 9c3e7e
 * @param extra  The TLV containing the cancellation.
Packit 9c3e7e
 */
Packit 9c3e7e
void unicast_service_remove(struct port *p, struct ptp_message *m,
Packit 9c3e7e
			    struct tlv_extra *extra);
Packit 9c3e7e
Packit 9c3e7e
/**
Packit 9c3e7e
 * Handles the unicast service timer, sending messages according to schedule.
Packit 9c3e7e
 * @param p      The port in question.
Packit 9c3e7e
 * @return       Zero on success, non-zero otherwise.
Packit 9c3e7e
 */
Packit 9c3e7e
int unicast_service_timer(struct port *p);
Packit 9c3e7e
Packit 9c3e7e
#endif