Zephyr Project API  3.2.0
A Scalable Open Source RTOS
canbus.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_NET_CAN_H_
8#define ZEPHYR_INCLUDE_NET_CAN_H_
9
10#include <zephyr/types.h>
11#include <zephyr/net/net_ip.h>
12#include <zephyr/net/net_if.h>
13#include <zephyr/drivers/can.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
22struct canbus_api {
27 struct net_if_api iface_api;
28
30 int (*send)(const struct device *dev, struct net_pkt *pkt);
31
33 void (*close)(const struct device *dev, int filter_id);
34
36 int (*setsockopt)(const struct device *dev, void *obj, int level,
37 int optname,
38 const void *optval, socklen_t optlen);
39
41 int (*getsockopt)(const struct device *dev, void *obj, int level,
42 int optname,
43 const void *optval, socklen_t *optlen);
44};
45
46/* Make sure that the network interface API is properly setup inside
47 * CANBUS API struct (it is the first one).
48 */
49BUILD_ASSERT(offsetof(struct canbus_api, iface_api) == 0);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif /* ZEPHYR_INCLUDE_NET_CAN_H_ */
size_t socklen_t
Definition: net_ip.h:167
Public API for network interface.
IPv6 and IPv4 definitions.
Definition: canbus.h:22
int(* getsockopt)(const struct device *dev, void *obj, int level, int optname, const void *optval, socklen_t *optlen)
Definition: canbus.h:41
int(* send)(const struct device *dev, struct net_pkt *pkt)
Definition: canbus.h:30
int(* setsockopt)(const struct device *dev, void *obj, int level, int optname, const void *optval, socklen_t optlen)
Definition: canbus.h:36
void(* close)(const struct device *dev, int filter_id)
Definition: canbus.h:33
struct net_if_api iface_api
Definition: canbus.h:27
Runtime device structure (in ROM) per driver instance.
Definition: device.h:435
Network packet.
Definition: net_pkt.h:59