Skip to content

Commit

Permalink
Move the network interface into its own header file.
Browse files Browse the repository at this point in the history
Up until now, the users of the interface data structure simply access
its fields without restriction.  This patch takes the first step
towards abstracting this data structure by giving it a file of its
very own.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
  • Loading branch information
richardcochran committed Mar 4, 2020
1 parent 9dcd6c3 commit c5b9ab9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
15 changes: 1 addition & 14 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,12 @@
#include "ds.h"
#include "dm.h"
#include "filter.h"
#include "interface.h"
#include "mtab.h"
#include "transport.h"
#include "servo.h"
#include "sk.h"

#define MAX_IFNAME_SIZE 108 /* = UNIX_PATH_MAX */

#if (IF_NAMESIZE > MAX_IFNAME_SIZE)
#error if_namesize larger than expected.
#endif

/** Defines a network interface, with PTP options. */
struct interface {
STAILQ_ENTRY(interface) list;
char name[MAX_IFNAME_SIZE + 1];
char ts_label[MAX_IFNAME_SIZE + 1];
struct sk_ts_info ts_info;
};

struct config {
/* configured interfaces */
STAILQ_HEAD(interfaces_head, interface) interfaces;
Expand Down
28 changes: 28 additions & 0 deletions interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @file interface.h
* @brief Implements network interface data structures.
* @note Copyright (C) 2020 Richard Cochran <richardcochran@gmail.com>
* @note SPDX-License-Identifier: GPL-2.0+
*/
#ifndef HAVE_INTERFACE_H
#define HAVE_INTERFACE_H

#include <sys/queue.h>
#include "sk.h"

#define MAX_IFNAME_SIZE 108 /* = UNIX_PATH_MAX */

#if (IF_NAMESIZE > MAX_IFNAME_SIZE)
#error if_namesize larger than expected.
#endif

/** Defines a network interface, with PTP options. */
struct interface {
STAILQ_ENTRY(interface) list;
char name[MAX_IFNAME_SIZE + 1];
char ts_label[MAX_IFNAME_SIZE + 1];
struct sk_ts_info ts_info;
};

#endif

0 comments on commit c5b9ab9

Please sign in to comment.