Mistake on this page?
Report an issue in GitHub or email us
cellular_driver_l3ip.h
1 /*
2  * Copyright (c) 2019 ARM Limited
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef CELLULAR_DRIVER_L3IP_H_
19 #define CELLULAR_DRIVER_L3IP_H_
20 
21 #include "L3IP.h"
22 
23 
24 class Cellular_driver_L3IP : public L3IP {
25 public:
27 
28  static Cellular_driver_L3IP &get_instance();
29 
30  /**
31  * Return maximum transmission unit
32  *
33  * @return MTU in bytes
34  */
35  virtual uint32_t get_mtu_size() const;
36 
37  /**
38  * Gets memory buffer alignment preference
39  *
40  * Gets preferred memory buffer alignment of the cellular device.
41  * @return Memory alignment requirement in bytes
42  */
43  virtual uint32_t get_align_preference() const;
44 
45  /**
46  * Return interface name
47  *
48  * @param name Pointer to where the name should be written
49  * @param size Maximum number of characters to copy
50  */
51  virtual void get_ifname(char *name, uint8_t size) const;
52 
53  /**
54  * Sends the packet over the link
55  *
56  * That cannot be called from an interrupt context.
57  *
58  * @param buf Packet to be sent
59  * @return True if the packet was sent, false otherwise
60  */
61  virtual bool link_out(net_stack_mem_buf_t *buf);
62 
63  /**
64  * Initializes the hardware
65  *
66  * @return True on success, False in case of an error.
67  */
68  virtual bool power_up();
69 
70  /**
71  * Deinitializes the hardware
72  *
73  */
74  virtual void power_down();
75 
76  /**
77  * Sets a callback that needs to be called for packets received for that interface
78  *
79  * @param input_cb Function to be register as a callback
80  */
81  virtual void set_link_input_cb(l3ip_link_input_cb_t input_cb);
82 
83  /**
84  * Sets a callback that needs to be called on link status changes for given interface
85  *
86  * @param state_cb Function to be register as a callback
87  */
88  virtual void set_link_state_cb(l3ip_link_state_change_cb_t state_cb);
89 
90  /** Add device to an IP4 multicast group
91  *
92  * @param address an IP4 multicast group address
93  */
94  virtual void add_ipv4_multicast_group(const char *address);
95 
96  /** Add device to an IP6 multicast group
97  *
98  * @param address an IP6 multicast group address
99  */
100  virtual void add_ipv6_multicast_group(const char *address);
101 
102  /** Remove device from an IPV4 multicast group
103  *
104  * @param address An IPV4 multicast group address
105  */
106  virtual void remove_ipv4_multicast_group(const char *address);
107 
108  /** Remove device from an IPV6 multicast group
109  *
110  * @param address An IPV6 multicast group address
111  */
112  virtual void remove_ipv6_multicast_group(const char *address);
113 
114  /** Request reception of all multicast packets
115  *
116  * @param all True to receive all multicasts
117  * False to receive only multicasts addressed to specified groups
118  */
119  virtual void set_all_multicast(bool all);
120 
121  /** Sets memory manager that is used to handle memory buffers
122  *
123  * @param mem_mngr Pointer to memory manager
124  */
125  virtual void set_memory_manager(NetStackMemoryManager &mem_mngr);
126 
127 private:
128 
129  l3ip_link_input_cb_t l3ip_link_input_cb; /**< Callback for incoming data */
130  l3ip_link_state_change_cb_t l3ip_link_state_cb; /**< Link state change callback */
131  NetStackMemoryManager *memory_manager; /**< Memory manager */
132 
133 };
134 
135 #endif /* CELLULAR_DRIVER_L3IP_H_ */
virtual void set_all_multicast(bool all)
Request reception of all multicast packets.
virtual void add_ipv6_multicast_group(const char *address)
Add device to an IP6 multicast group.
virtual bool link_out(net_stack_mem_buf_t *buf)
Sends the packet over the link.
virtual bool power_up()
Initializes the hardware.
virtual void get_ifname(char *name, uint8_t size) const
Return interface name.
This interface should be used to abstract low level access to networking hardware All operations rece...
Definition: L3IP.h:31
virtual uint32_t get_align_preference() const
Gets memory buffer alignment preference.
virtual void set_memory_manager(NetStackMemoryManager &mem_mngr)
Sets memory manager that is used to handle memory buffers.
virtual void power_down()
Deinitializes the hardware.
virtual void set_link_input_cb(l3ip_link_input_cb_t input_cb)
Sets a callback that needs to be called for packets received for that interface.
virtual void remove_ipv4_multicast_group(const char *address)
Remove device from an IPV4 multicast group.
virtual void remove_ipv6_multicast_group(const char *address)
Remove device from an IPV6 multicast group.
virtual uint32_t get_mtu_size() const
Return maximum transmission unit.
Callback class based on template specialization.
Definition: Callback.h:39
mbed::Callback< void(net_stack_mem_buf_t *buf)> l3ip_link_input_cb_t
Callback to be registered with L3IP interface and to be called for received packets.
Definition: L3IP.h:47
virtual void add_ipv4_multicast_group(const char *address)
Add device to an IP4 multicast group.
virtual void set_link_state_cb(l3ip_link_state_change_cb_t state_cb)
Sets a callback that needs to be called on link status changes for given interface.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.