LCOV - code coverage report
Current view: top level - libsystemd-network - lldp-internal.h (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 0 2 0.0 %
Date: 2015-07-29 18:47:03 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : /***
       4             :   This file is part of systemd.
       5             : 
       6             :   Copyright (C) 2014 Tom Gundersen
       7             :   Copyright (C) 2014 Susant Sahani
       8             : 
       9             :   systemd is free software; you can redistribute it and/or modify it
      10             :   under the terms of the GNU Lesser General Public License as published by
      11             :   the Free Software Foundation; either version 2.1 of the License, or
      12             :   (at your option) any later version.
      13             : 
      14             :   systemd is distributed in the hope that it will be useful, but
      15             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      17             :   Lesser General Public License for more details.
      18             : 
      19             :   You should have received a copy of the GNU Lesser General Public License
      20             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      21             : ***/
      22             : 
      23             : #pragma once
      24             : 
      25             : #include "log.h"
      26             : #include "list.h"
      27             : #include "refcnt.h"
      28             : #include "lldp-tlv.h"
      29             : #include "prioq.h"
      30             : 
      31             : typedef struct lldp_neighbour_port lldp_neighbour_port;
      32             : typedef struct lldp_chassis lldp_chassis;
      33             : typedef struct lldp_chassis_id lldp_chassis_id;
      34             : typedef struct lldp_agent_statistics lldp_agent_statistics;
      35             : 
      36             : struct lldp_neighbour_port {
      37             :         uint8_t type;
      38             :         uint8_t *data;
      39             : 
      40             :         uint16_t length;
      41             :         usec_t until;
      42             : 
      43             :         unsigned prioq_idx;
      44             : 
      45             :         lldp_chassis *c;
      46             :         tlv_packet *packet;
      47             : 
      48             :         LIST_FIELDS(lldp_neighbour_port, port);
      49             : };
      50             : 
      51             : int lldp_neighbour_port_new(lldp_chassis *c, tlv_packet *tlv, lldp_neighbour_port **ret);
      52             : void lldp_neighbour_port_free(lldp_neighbour_port *p);
      53             : void lldp_neighbour_port_remove_and_free(lldp_neighbour_port *p);
      54             : 
      55           0 : DEFINE_TRIVIAL_CLEANUP_FUNC(lldp_neighbour_port *, lldp_neighbour_port_free);
      56             : #define _cleanup_lldp_neighbour_port_free_ _cleanup_(lldp_neighbour_port_freep)
      57             : 
      58             : struct lldp_chassis_id {
      59             :         uint8_t type;
      60             :         uint16_t length;
      61             : 
      62             :         uint8_t *data;
      63             : };
      64             : 
      65             : struct lldp_chassis {
      66             :         RefCount n_ref;
      67             : 
      68             :         lldp_chassis_id chassis_id;
      69             : 
      70             :         Prioq *by_expiry;
      71             :         Hashmap *neighbour_mib;
      72             : 
      73             :         LIST_HEAD(lldp_neighbour_port, ports);
      74             : };
      75             : 
      76             : int lldp_chassis_new(tlv_packet *tlv,
      77             :                      Prioq *by_expiry,
      78             :                      Hashmap *neighbour_mib,
      79             :                      lldp_chassis **ret);
      80             : 
      81             : void lldp_chassis_free(lldp_chassis *c);
      82             : 
      83           0 : DEFINE_TRIVIAL_CLEANUP_FUNC(lldp_chassis *, lldp_chassis_free);
      84             : #define _cleanup_lldp_chassis_free_ _cleanup_(lldp_chassis_freep)
      85             : 
      86             : int lldp_mib_update_objects(lldp_chassis *c, tlv_packet *tlv);
      87             : int lldp_mib_add_objects(Prioq *by_expiry, Hashmap *neighbour_mib, tlv_packet *tlv);
      88             : int lldp_mib_remove_objects(lldp_chassis *c, tlv_packet *tlv);
      89             : 
      90             : int lldp_read_chassis_id(tlv_packet *tlv, uint8_t *type, uint16_t *length, uint8_t **data);
      91             : int lldp_read_port_id(tlv_packet *tlv, uint8_t *type, uint16_t *length, uint8_t **data);
      92             : int lldp_read_ttl(tlv_packet *tlv, uint16_t *ttl);
      93             : int lldp_read_system_name(tlv_packet *tlv, uint16_t *length, char **data);
      94             : int lldp_read_system_description(tlv_packet *tlv, uint16_t *length, char **data);
      95             : int lldp_read_system_capability(tlv_packet *tlv, uint16_t *data);
      96             : int lldp_read_port_description(tlv_packet *tlv, uint16_t *length, char **data);
      97             : 
      98             : int lldp_handle_packet(tlv_packet *m, uint16_t length);
      99             : #define log_lldp(fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "LLDP: " fmt, ##__VA_ARGS__)

Generated by: LCOV version 1.11