port: Add a method for processing received signaling messages.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2018-04-03 18:37:05 -07:00
parent e8e2be017a
commit c2ab96fd40
2 changed files with 39 additions and 0 deletions

View File

@ -172,6 +172,7 @@ void process_follow_up(struct port *p, struct ptp_message *m);
int process_pdelay_req(struct port *p, struct ptp_message *m);
int process_pdelay_resp(struct port *p, struct ptp_message *m);
void process_pdelay_resp_fup(struct port *p, struct ptp_message *m);
int process_signaling(struct port *p, struct ptp_message *m);
void process_sync(struct port *p, struct ptp_message *m);
int source_pid_eq(struct ptp_message *m1, struct ptp_message *m2);
void ts_add(tmv_t *ts, Integer64 correction);

View File

@ -18,6 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA.
*/
#include "port_private.h"
#include "unicast_client.h"
struct ptp_message *port_signaling_construct(struct port *p,
struct address *address,
@ -44,3 +45,40 @@ struct ptp_message *port_signaling_construct(struct port *p,
return msg;
}
int process_signaling(struct port *p, struct ptp_message *m)
{
struct tlv_extra *extra;
int err = 0;
switch (p->state) {
case PS_INITIALIZING:
case PS_FAULTY:
case PS_DISABLED:
return 0;
case PS_LISTENING:
case PS_PRE_MASTER:
case PS_MASTER:
case PS_GRAND_MASTER:
case PS_PASSIVE:
case PS_UNCALIBRATED:
case PS_SLAVE:
break;
}
TAILQ_FOREACH(extra, &m->tlv_list, list) {
switch (extra->tlv->type) {
case TLV_REQUEST_UNICAST_TRANSMISSION:
break;
case TLV_GRANT_UNICAST_TRANSMISSION:
unicast_client_grant(p, m, extra);
break;
case TLV_CANCEL_UNICAST_TRANSMISSION:
err = unicast_client_cancel(p, m, extra);
break;
case TLV_ACKNOWLEDGE_CANCEL_UNICAST_TRANSMISSION:
break;
}
}
return err;
}