diff --git a/README.md b/README.md index f497843..2d0a0e9 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ ## Межпроцессное взаимодействие +### Разделяемая память + При запуске ПО выделяет блок разделяемой памяти с наименованием ***"profinet_shared_data"***. Структура описана в ***profinet_data_map.hpp***. @@ -173,6 +175,18 @@ endian_convert_32((uint8_t*)&Echo_inpCycData.data.data_f); echo_submod_ptr->inp_data.Write(0, Echo_inpCycData.mem, echo_submod_ptr->cyc_indata_len); ``` +### pipe каналы + +Обмен происходит по двум каналам, по умолчанию это: +* profinet_io_dev_out +* profinet_io_dev_inp + +Путь к аналам задается в конфигурационном файле `program_configure.json`. + +ПО сначала открывает канал для чтения(inp), затем ожидает подключения клиента, после чего открывает канал для записи(out). + +Обмен происходит с помощью json rpc, протокол описан в файле `src/interprocess/pipes/json_rpc_protocol.txt`. + diff --git a/libs/include/pnal.h b/libs/include/pnal.h new file mode 100644 index 0000000..03b89c7 --- /dev/null +++ b/libs/include/pnal.h @@ -0,0 +1,552 @@ +/********************************************************************* + * _ _ _ + * _ __ | |_ _ | | __ _ | |__ ___ + * | '__|| __|(_)| | / _` || '_ \ / __| + * | | | |_ _ | || (_| || |_) |\__ \ + * |_| \__|(_)|_| \__,_||_.__/ |___/ + * + * www.rt-labs.com + * Copyright 2018 rt-labs AB, Sweden. + * + * This software is dual-licensed under GPLv3 and a commercial + * license. See the file LICENSE.md distributed with this software for + * full license information. + ********************************************************************/ + +/** + * @file + * @brief Definitions for profinet abstraction layer. + * + * The Ethernet-related functions should not use \a loc_port_num, but + * the interface name instead. The lookup from \a loc_port_num to + * interface name must happen somewhere else in the stack. + */ + +#ifndef PNAL_H +#define PNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "options.h" +#include "pnet_api.h" +#include "pnal_sys.h" + +#define PNAL_MAKEU32(a, b, c, d) \ + (((uint32_t)((a)&0xff) << 24) | ((uint32_t)((b)&0xff) << 16) | \ + ((uint32_t)((c)&0xff) << 8) | (uint32_t)((d)&0xff)) + +#define PNAL_MAKEU16(a, b) (((uint16_t)((a)&0xff) << 8) | (uint16_t)((b)&0xff)) + +#define PNAL_INET_ADDRSTR_SIZE 16 /** Incl termination */ +#define PNAL_ETH_ADDRSTR_SIZE 18 /** Incl termination */ +#ifndef PNAL_HOSTNAME_MAX_SIZE +#define PNAL_HOSTNAME_MAX_SIZE 64 /** Incl termination. Value from Linux. */ +#endif + +/** + * Ethernet autonegotiation capabilities (not exhaustive) + * + * See IEEE 802.3 (Ethernet) ch. 30.6 "Management for link Auto-Negotiation". + * + * See IETF RFC 4836 "Definitions of Managed Objects for + * IEEE 802.3 Medium Attachment Units (MAUs)", object + * "IANAifMauAutoNegCapBits" + */ +#define PNAL_ETH_AUTONEG_CAP_1000BaseT_FULL_DUPLEX BIT (0) +#define PNAL_ETH_AUTONEG_CAP_1000BaseT_HALF_DUPLEX BIT (1) +#define PNAL_ETH_AUTONEG_CAP_1000BaseX_FULL_DUPLEX BIT (2) +#define PNAL_ETH_AUTONEG_CAP_1000BaseX_HALF_DUPLEX BIT (3) +#define PNAL_ETH_AUTONEG_CAP_100BaseTX_FULL_DUPLEX BIT (10) +#define PNAL_ETH_AUTONEG_CAP_100BaseTX_HALF_DUPLEX BIT (11) +#define PNAL_ETH_AUTONEG_CAP_10BaseT_FULL_DUPLEX BIT (13) +#define PNAL_ETH_AUTONEG_CAP_10BaseT_HALF_DUPLEX BIT (14) +#define PNAL_ETH_AUTONEG_CAP_UNKNOWN BIT (15) + +/** + * Ethernet MAU type (not exhaustive). + * + * See IEEE 802.3 (Ethernet) ch. 30.5 "Layer management for medium + * attachment units (MAUs)". + * + * See IETF RFC 4836 "Definitions of Managed Objects for + * IEEE 802.3 Medium Attachment Units (MAUs)", objects + * "IANAifMauTypeListBits" and "dot3MauType". + * + * See Profinet "5.2.12.3.12 Coding of the field MAUType" + */ +typedef enum pnal_eth_mau +{ + PNAL_ETH_MAU_UNKNOWN = 0x00, /* When link is down */ + PNAL_ETH_MAU_RADIO = 0x00, /* When link is up */ + PNAL_ETH_MAU_COPPER_10BaseT = 0x05, + PNAL_ETH_MAU_COPPER_100BaseTX_HALF_DUPLEX = 0x0F, + PNAL_ETH_MAU_COPPER_100BaseTX_FULL_DUPLEX = 0x10, + PNAL_ETH_MAU_COPPER_1000BaseT_HALF_DUPLEX = 0x1D, + PNAL_ETH_MAU_COPPER_1000BaseT_FULL_DUPLEX = 0x1E, + PNAL_ETH_MAU_FIBER_100BaseFX_HALF_DUPLEX = 0x11, + PNAL_ETH_MAU_FIBER_100BaseFX_FULL_DUPLEX = 0x12, + PNAL_ETH_MAU_FIBER_1000BaseX_HALF_DUPLEX = 0x15, + PNAL_ETH_MAU_FIBER_1000BaseX_FULL_DUPLEX = 0x16, +} pnal_eth_mau_t; + +/* See Profinet 2.4 section 5.2.28 and annex W */ +typedef struct pnal_port_stats +{ + uint32_t if_in_octets; + uint32_t if_out_octets; + uint32_t if_in_discards; + uint32_t if_out_discards; + uint32_t if_in_errors; + uint32_t if_out_errors; +} pnal_port_stats_t; + +/** Set an IP address given by the four byte-parts */ +#define PNAL_IP4_ADDR_TO_U32(ipaddr, a, b, c, d) \ + ipaddr = PNAL_MAKEU32 (a, b, c, d) + +typedef enum pnal_ethertype +{ + PNAL_ETHTYPE_IP = 0x0800U, + PNAL_ETHTYPE_ARP = 0x0806U, + PNAL_ETHTYPE_VLAN = 0x8100U, + PNAL_ETHTYPE_PROFINET = 0x8892U, + PNAL_ETHTYPE_ETHERCAT = 0x88A4U, + PNAL_ETHTYPE_LLDP = 0x88CCU, + PNAL_ETHTYPE_ALL = 0xFFFFU, +} pnal_ethertype_t; + +/* 255.255.255.255 */ +#ifndef PNAL_IPADDR_NONE +#define PNAL_IPADDR_NONE ((uint32_t)0xffffffffUL) +#endif +/* 127.0.0.1 */ +#ifndef PNAL_IPADDR_LOOPBACK +#define PNAL_IPADDR_LOOPBACK ((uint32_t)0x7f000001UL) +#endif +/* 0.0.0.0 */ +#ifndef PNAL_IPADDR_ANY +#define PNAL_IPADDR_ANY ((uint32_t)0x00000000UL) +#endif +#define PNAL_IPADDR_INVALID PNAL_IPADDR_ANY +/* 255.255.255.255 */ +#ifndef PNAL_IPADDR_BROADCAST +#define PNAL_IPADDR_BROADCAST ((uint32_t)0xffffffffUL) +#endif + +typedef uint32_t pnal_ipaddr_t; +typedef uint16_t pnal_ipport_t; + +/** + * The Ethernet MAC address. + * + * TODO: Remove this and use pnet_ethaddr_t instead + */ +typedef struct pnal_ethaddr +{ + uint8_t addr[6]; +} pnal_ethaddr_t; + +/** + * Ethernet link status. + * + * See also type pf_lldp_link_status_t. + */ +typedef struct pnal_eth_status_t +{ + /* Is autonegotiation supported on this port? */ + bool is_autonegotiation_supported; + + /* Is autonegotiation supported on this port? */ + bool is_autonegotiation_enabled; + + /* Capabilities advertised to link partner during autonegotiation. + * + * See macros PNAL_ETH_AUTONEG_CAP_xxx. + */ + uint16_t autonegotiation_advertised_capabilities; + + /* Operational MAU type. + * + * This specifies both the physical medium as well as + * speed and duplex setting used for the link. + */ + pnal_eth_mau_t operational_mau_type; + + /* Corresponds to linux "RUNNING" flag. + * Up and cable connected + */ + bool running; +} pnal_eth_status_t; + +/** + * Get system uptime from the SNMP implementation. + * + * This is the sysUpTime, as used by SNMP: + * "The time (in hundredths of a second) since the network + * management portion of the system was last re-initialized." + * - IETF RFC 3418 (SNMP MIB-2). + * + * Typically used to store the SNMP-timestamp for incoming LLDP-packets. + * This timestamp is later reported back to the SNMP implementation, and + * remote SNMP managers might use it for filtering. + * + * The returned value should be the one used by the SNMP implementation. + * Ask the SNMP implementation for the value, or make sure that this + * function and the SNMP implementation use the same mechanism to get the + * value. + * + * Starts at 0, with wrap-around after ~497 days. + * + * @return System uptime, in units of 10 milliseconds. + */ +uint32_t pnal_get_system_uptime_10ms (void); + +/** + * Load a binary file. + * + * Can load the data into two buffers. + * + * @param fullpath In: Full path to the file + * @param object_1 Out: Data to load, or NULL. Mandatory if size_1 > 0 + * @param size_1 In: Size of object_1. + * @param object_2 Out: Data to load, or NULL. Mandatory if size_2 > 0 + * @param size_2 In: Size of object_2. + * @return 0 if the operation succeeded. + * -1 if not found or an error occurred. + */ +int pnal_load_file ( + const char * fullpath, + void * object_1, + size_t size_1, + void * object_2, + size_t size_2); + +/** + * Save a binary file. + * + * Can handle two output buffers. + * + * @param fullpath In: Full path to the file + * @param object_1 In: Data to save, or NULL. Mandatory if size_1 > 0 + * @param size_1 In: Size of object_1. + * @param object_2 In: Data to save, or NULL. Mandatory if size_2 > 0 + * @param size_2 In: Size of object_2. + * @return 0 if the operation succeeded. + * -1 if an error occurred. + */ +int pnal_save_file ( + const char * fullpath, + const void * object_1, + size_t size_1, + const void * object_2, + size_t size_2); + +/** + * Clear a binary file. + * + * @param fullpath In: Full path to the file + */ +void pnal_clear_file (const char * fullpath); + +/* + */ + +/** + * Allocate a buffer + * + * The resulting \a pnal_buf_t buffer is defined for + * each operating system, and should at least contain: + * void * payload; + * uint16_t len; + * + * @param length In: Length, in bytes + * @return a pnal_buf_t, or NULL at failure + */ +pnal_buf_t * pnal_buf_alloc (uint16_t length); + +/** + * Free a buffer + * + * @param p In: Buffer to free + */ +void pnal_buf_free (pnal_buf_t * p); + +/** Not yet used */ +uint8_t pnal_buf_header (pnal_buf_t * p, int16_t header_size_increment); + +/** + * Network interface handle, forward declaration. + */ +typedef struct pnal_eth_handle pnal_eth_handle_t; + +/** + * The prototype of raw Ethernet reception call-back functions. + * + * @param eth_handle InOut: Network interface handle + * @param arg InOut: User-defined (may be NULL). + * @param p_buf InOut: The incoming Ethernet frame + * + * @return 0 If the frame was NOT handled by this function. + * 1 If the frame was handled and the buffer freed. + */ +typedef int (pnal_eth_callback_t) ( + pnal_eth_handle_t * eth_handle, + void * arg, + pnal_buf_t * p_buf); + +/** + * Get status of Ethernet link on specified port + * + * @param interface_name In: Ethernet interface name, for example eth0 + * @param status Out: Returned link status (autoneg etc) + * @return 0 if the operation succeeded. + * -1 if an error occurred. + */ +int pnal_eth_get_status ( + const char * interface_name, + pnal_eth_status_t * status); + +/** + * Get network interface index + * + * The interface index (ifIndex) is the (row) index for the network interface + * in the table ifTable, which is part of the SNMP MIB-II data structure. + * See RFC 2863 "The Interfaces Group MIB". + * + * @param interface_name In: Ethernet interface name, for example eth0 + * + * @return The interface index, or 0 if not available. + */ +int pnal_get_interface_index (const char * interface_name); + +/** + * Get network interface (port) statistics + * + * In Profinet naming a physical Ethernet interface is a "port". + * This corresponds to for example a Linux Ethernet interface. + * + * @param interface_name In: Ethernet interface name for example eth0 + * @param port_stats Out: Returned statistics + * + * @return 0 if the operation succeeded. + * -1 if an error occurred. + */ +int pnal_get_port_statistics ( + const char * interface_name, + pnal_port_stats_t * port_stats); + +/** + * Send raw Ethernet data + * + * @param handle In: Ethernet handle + * @param buf In: Buffer with data to be sent + * @return The number of bytes sent, or -1 if an error occurred. + */ +int pnal_eth_send (pnal_eth_handle_t * handle, pnal_buf_t * buf); + +/** + * Initialize receiving of raw Ethernet frames on one interface (in separate + * thread) + * + * @param if_name In: Ethernet interface name + * @param receive_type In: Ethernet frame types that shall be received + * by the network interface / port. + * @param pnal_cfg In: Operating system dependent configuration + * @param callback In: Callback for received raw Ethernet frames + * @param arg InOut: User argument passed to the callback + * + * @return the Ethernet handle, or NULL if an error occurred. + */ +pnal_eth_handle_t * pnal_eth_init ( + const char * if_name, + pnal_ethertype_t receive_type, + const pnal_cfg_t * pnal_cfg, + pnal_eth_callback_t * callback, + void * arg); + +/** + * Open an UDP socket + * + * @param addr In: IP address to listen to. Typically used with + * PNAL_IPADDR_ANY. + * @param port In: UDP port to listen to. + * @return Socket ID, or -1 if an error occurred. + */ +int pnal_udp_open (pnal_ipaddr_t addr, pnal_ipport_t port); + +/** + * Send UDP data + * + * @param id In: Socket ID + * @param dst_addr In: Destination IP address + * @param dst_port In: Destination UDP port + * @param data In: Data to be sent + * @param size In: Size of data + * @return The number of bytes sent, or -1 if an error occurred. + */ +int pnal_udp_sendto ( + uint32_t id, + pnal_ipaddr_t dst_addr, + pnal_ipport_t dst_port, + const uint8_t * data, + int size); + +/** + * Receive UDP data. + * + * This is a nonblocking function, and it + * returns 0 immediately if no data is available. + * + * @param id In: Socket ID + * @param dst_addr Out: Source IP address + * @param dst_port Out: Source UDP port + * @param data Out: Received data + * @param size In: Size of buffer for received data + * @return The number of bytes received, or -1 if an error occurred. + */ +int pnal_udp_recvfrom ( + uint32_t id, + pnal_ipaddr_t * src_addr, + pnal_ipport_t * src_port, + uint8_t * data, + int size); + +/** + * Close an UDP socket + * + * @param id In: Socket ID + */ +void pnal_udp_close (uint32_t id); + +/** + * Configure SNMP server. + * + * This function configures a platform-specific SNMP server as to + * enable a connected SNMP client to read variables from the p-net stack, + * as well as to write some variables to it. + * + * @param net InOut: The p-net stack instance + * @param pnal_cfg In: Operating system dependent configuration + * @return 0 if the operation succeeded. + * -1 if an error occurred. + */ +int pnal_snmp_init (pnet_t * net, const pnal_cfg_t * pnal_cfg); + +/** + * Get network parameters (IP address, netmask etc) + * + * For example: + * + * IP address Represented by + * 1.0.0.0 0x01000000 = 16777216 + * 0.0.0.1 0x00000001 = 1 + * + * @param interface_name In: Ethernet interface name, for example eth0 + * @param p_ipaddr Out: IPv4 address + * @param p_netmask Out: Netmask + * @param p_gw Out: Default gateway + * @param hostname Out: Host name, for example my_laptop_4. Existing + * buffer should have size + * PNAL_HOSTNAME_MAX_SIZE. + * @return 0 if the operation succeeded. + * -1 if an error occurred. + */ +int pnal_get_ip_suite ( + const char * interface_name, + pnal_ipaddr_t * p_ipaddr, + pnal_ipaddr_t * p_netmask, + pnal_ipaddr_t * p_gw, + char * hostname); + +/** + * Read the IP address as an integer. For IPv4. + * + * For example: + * + * IP address Represented by + * 1.0.0.0 0x01000000 = 16777216 + * 0.0.0.1 0x00000001 = 1 + * + * @param interface_name In: Name of network interface + * @return IP address on success and + * 0 if an error occurred + */ +pnal_ipaddr_t pnal_get_ip_address (const char * interface_name); + +/** + * Read the netmask as an integer. For IPv4. + * + * @param interface_name In: Name of network interface + * @return netmask + */ +pnal_ipaddr_t pnal_get_netmask (const char * interface_name); + +/** + * Read the default gateway address as an integer. For IPv4. + * + * Assumes the default gateway is found on .1 on same subnet as the IP address. + * + * @param interface_name In: Name of network interface + * @return netmask + */ +pnal_ipaddr_t pnal_get_gateway (const char * interface_name); + +/** + * Read the MAC address. + * + * @param interface_name In: Name of network interface + * @param mac_addr Out: MAC address + * + * @return 0 on success and + * -1 if no such interface is available + */ +int pnal_get_macaddress (const char * interface_name, pnal_ethaddr_t * p_mac); + +/** + * Read the current host name + * + * @param hostname Out: Host name, for example my_laptop_4. Existing + * buffer should have size + * PNAL_HOSTNAME_MAX_SIZE. + * @return 0 on success and + * -1 if an error occurred + */ +int pnal_get_hostname (char * hostname); + +/** + * Set network parameters (IP address, netmask etc) + * + * For example: + * + * IP address Represented by + * 1.0.0.0 0x01000000 = 16777216 + * 0.0.0.1 0x00000001 = 1 + * + * @param interface_name In: Ethernet interface name, for example eth0 + * @param p_ipaddr In: IPv4 address + * @param p_netmask In: Netmask + * @param p_gw In: Default gateway + * @param hostname In: Host name, for example my_laptop_4 + * @param permanent In: 1 if changes are permanent, or 0 if temporary + * @return 0 if the operation succeeded. + * -1 if an error occurred. + */ +int pnal_set_ip_suite ( + const char * interface_name, + const pnal_ipaddr_t * p_ipaddr, + const pnal_ipaddr_t * p_netmask, + const pnal_ipaddr_t * p_gw, + const char * hostname, + bool permanent); + +#ifdef __cplusplus +} +#endif + +#endif /* PNAL_H */ diff --git a/libs/include/sys/pnal_sys.h b/libs/include/sys/pnal_sys.h new file mode 100644 index 0000000..e38d1a5 --- /dev/null +++ b/libs/include/sys/pnal_sys.h @@ -0,0 +1,39 @@ +/********************************************************************* + * _ _ _ + * _ __ | |_ _ | | __ _ | |__ ___ + * | '__|| __|(_)| | / _` || '_ \ / __| + * | | | |_ _ | || (_| || |_) |\__ \ + * |_| \__|(_)|_| \__,_||_.__/ |___/ + * + * www.rt-labs.com + * Copyright 2018 rt-labs AB, Sweden. + * + * This software is dual-licensed under GPLv3 and a commercial + * license. See the file LICENSE.md distributed with this software for + * full license information. + ********************************************************************/ + +#ifndef PNAL_SYS_H +#define PNAL_SYS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "osal.h" + +#include + +#define PNAL_BUF_MAX_SIZE 1522 + +typedef struct os_buf +{ + void * payload; + uint16_t len; +} pnal_buf_t; + +#ifdef __cplusplus +} +#endif + +#endif /* PNAL_SYS_H */ diff --git a/libs/include/x86_64/options.h b/libs/include/x86_64/options.h new file mode 100755 index 0000000..c69f40c --- /dev/null +++ b/libs/include/x86_64/options.h @@ -0,0 +1,246 @@ +/********************************************************************* + * _ _ _ + * _ __ | |_ _ | | __ _ | |__ ___ + * | '__|| __|(_)| | / _` || '_ \ / __| + * | | | |_ _ | || (_| || |_) |\__ \ + * |_| \__|(_)|_| \__,_||_.__/ |___/ + * + * www.rt-labs.com + * Copyright 2018 rt-labs AB, Sweden. + * + * This software is dual-licensed under GPLv3 and a commercial + * license. See the file LICENSE.md distributed with this software for + * full license information. + ********************************************************************/ + +#ifndef OPTIONS_H +#define OPTIONS_H + +/** + * # Profinet Stack Options + * + * The defines named `PNET_OPTION_*` may be used to extend or reduce + * the functionality of the stack. Setting these values to 0 excludes + * the specific function and may also reduce the memory usage of the + * Profinet stack. + * + * Note that none of these options are currently supported (even if + * enabled by setting the value to 1), except for parsing the RPC + * Connect request message and generating the connect RPC Connect + * response message. + */ + +#if !defined (PNET_OPTION_FAST_STARTUP) +#define PNET_OPTION_FAST_STARTUP 1 +#endif + +#if !defined (PNET_OPTION_PARAMETER_SERVER) +#define PNET_OPTION_PARAMETER_SERVER 1 +#endif + +#if !defined (PNET_OPTION_IR) +#define PNET_OPTION_IR 1 +#endif + +#if !defined (PNET_OPTION_SR) +#define PNET_OPTION_SR 1 +#endif + +#if !defined (PNET_OPTION_REDUNDANCY) +#define PNET_OPTION_REDUNDANCY 1 +#endif + +#if !defined (PNET_OPTION_AR_VENDOR_BLOCKS) +#define PNET_OPTION_AR_VENDOR_BLOCKS 1 +#endif + +#if !defined (PNET_OPTION_RS) +#define PNET_OPTION_RS 1 +#endif + +#if !defined (PNET_OPTION_MC_CR) +#define PNET_OPTION_MC_CR 1 +#endif + +#if !defined (PNET_OPTION_SRL) +#define PNET_OPTION_SRL 0 +#endif + +#if !defined (PNET_OPTION_SNMP) +#define PNET_OPTION_SNMP 0 +#endif + +/** + * Disable use of atomic operations (stdatomic.h). + * If the compiler supports it then set this define to 1. + */ +/* TODO: compiler abstraction should be handled by cc.h */ +#if !defined (PNET_USE_ATOMICS) +#define PNET_USE_ATOMICS 0 +#endif + +/** + * # Memory Usage + * + * Memory usage is controlled by the `PNET_MAX_*` defines. Define the + * required number of supported items. + * + * These values directly affect the memory usage of the + * implementation. Sometimes in complicated ways. + * + * Please note that some defines have minimum requirements. + * Only a few of the defines are validated. + */ + +#if !defined (PNET_MAX_AR) +/** Number of connections. Must be > 0. "Automated RT Tester" uses 2 */ +#define PNET_MAX_AR 2 +#endif + +#if !defined (PNET_MAX_API) +/** Number of Application Processes. Must be > 0. */ +#define PNET_MAX_API 1 +#endif + +#if !defined (PNET_MAX_CR) +/** Per AR. 1 input and 1 output. */ +#define PNET_MAX_CR 2 +#endif + +#if !defined (PNET_MAX_SLOTS) +/** Per API. Should be > 1 to allow at least one I/O module. */ +#define PNET_MAX_SLOTS 5 +#endif + +#if !defined (PNET_MAX_SUBSLOTS) +/** Per slot (3 needed for DAP). */ +#define PNET_MAX_SUBSLOTS 3 +#endif + +#if !defined (PNET_MAX_DFP_IOCR) +/** Allowed values are 0 (zero) or 2. */ +#define PNET_MAX_DFP_IOCR 2 +#endif + +#if !defined (PNET_MAX_LOG_BOOK_ENTRIES) +#define PNET_MAX_LOG_BOOK_ENTRIES 16 +#endif + +#if !defined (PNET_MAX_ALARMS) +/** Per AR and queue. One queue for hi and one for lo alarms. */ +#define PNET_MAX_ALARMS 6 +#endif + +#if !defined (PNET_MAX_ALARM_PAYLOAD_DATA_SIZE) +/** Max size of alarm payload */ +#define PNET_MAX_ALARM_PAYLOAD_DATA_SIZE 28 +#endif + +#if !defined (PNET_MAX_DIAG_ITEMS) +/** Total, per device. Max is 65534 items. */ +#define PNET_MAX_DIAG_ITEMS 200 +#endif + +#if !defined (PNET_MAX_DIAG_MANUF_DATA_SIZE) +/** Max size of manufacturer specific diagnosis data */ +#define PNET_MAX_DIAG_MANUF_DATA_SIZE 16 +#endif + +#if PNET_OPTION_MC_CR + +#if !defined (PNET_MAX_MC_CR) +/**< Per AR. */ +#define PNET_MAX_MC_CR 1 +#endif + +#endif /* PNET_OPTION_MC_CR */ + +#if PNET_OPTION_AR_VENDOR_BLOCKS + +#if !defined (PNET_MAX_AR_VENDOR_BLOCKS) +/**< Must be > 0 */ +#define PNET_MAX_AR_VENDOR_BLOCKS 1 +#endif + +#if !defined (PNET_MAX_AR_VENDOR_BLOCK_DATA_LENGTH) +#define PNET_MAX_AR_VENDOR_BLOCK_DATA_LENGTH 512 +#endif + +#endif /* PNET_OPTION_AR_VENDOR_BLOCKS */ + +#if !defined (PNET_MAX_MAN_SPECIFIC_FAST_STARTUP_DATA_LENGTH) +/** or 512 (bytes) */ +#define PNET_MAX_MAN_SPECIFIC_FAST_STARTUP_DATA_LENGTH 0 +#endif + +#if !defined (PNET_MAX_SESSION_BUFFER_SIZE) +/** Max fragmented RPC request/response length */ +#define PNET_MAX_SESSION_BUFFER_SIZE 4500 +#endif + +#if !defined (PNET_MAX_FILENAME_SIZE) +/** Max filename size, including termination */ +#define PNET_MAX_FILENAME_SIZE 30 +#endif + +#if !defined (PNET_MAX_PORT_DESCRIPTION_SIZE) +/** Max port description size, including termination */ +#define PNET_MAX_PORT_DESCRIPTION_SIZE 60 +#endif + + +/** + * # Logging + * + * The following options controlling logging. + */ + +#ifndef LOG_LEVEL +#define LOG_LEVEL (LOG_LEVEL_FATAL) +#endif + +#ifndef PF_ETH_LOG +#define PF_ETH_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_LLDP_LOG +#define PF_LLDP_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_SNMP_LOG +#define PF_SNMP_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_CPM_LOG +#define PF_CPM_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_PPM_LOG +#define PF_PPM_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_DCP_LOG +#define PF_DCP_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_RPC_LOG +#define PF_RPC_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_ALARM_LOG +#define PF_ALARM_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_AL_BUF_LOG +#define PF_AL_BUF_LOG (LOG_STATE_ON) +#endif + +#ifndef PF_PNAL_LOG +#define PF_PNAL_LOG (LOG_STATE_ON) +#endif + +#ifndef PNET_LOG +#define PNET_LOG (LOG_STATE_ON) +#endif + +#endif /* OPTIONS_H */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ffeb1c3..afb8aeb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,9 +39,8 @@ target_include_directories(${TARGET_NAME} PRIVATE ${INC_DIRS} ${LIBS_INSTALL_PATH}/include ${LIBS_INSTALL_PATH}/include/sys - ${PNET_PATH}/build/src - ${PNET_PATH}/src - ${PNET_PATH}/src/ports/linux + ${LIBS_INSTALL_PATH}/include/x86_64 + ) target_link_directories(${TARGET_NAME} PUBLIC ${LIBS_INSTALL_PATH}/lib/x86_64)