Generic interface for IPC communication between GNRC modules.  
More...
Generic interface for IPC communication between GNRC modules. 
The idea of this interface is that it provides every network module with a basic set of commands to communicate with its neighboring modules. In this model every module runs in its own thread and communication is done using the GNRC communication interface. 
 | 
| file   | netapi.h | 
|   | Generic interface to communicate with GNRC modules. 
  | 
|   | 
 | 
| int  | _gnrc_netapi_send_recv (kernel_pid_t pid, gnrc_pktsnip_t *pkt, uint16_t type) | 
|   | Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SND or GNRC_NETAPI_MSG_TYPE_RCV messages.  More...
  | 
|   | 
| int  | _gnrc_netapi_get_set (kernel_pid_t pid, netopt_t opt, uint16_t context, void *data, size_t data_len, uint16_t type) | 
|   | Shortcut function for sending GNRC_NETAPI_MSG_TYPE_GET or GNRC_NETAPI_MSG_TYPE_SET messages and parsing the returned GNRC_NETAPI_MSG_TYPE_ACK message.  More...
  | 
|   | 
| static int  | gnrc_netapi_send (kernel_pid_t pid, gnrc_pktsnip_t *pkt) | 
|   | Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SND messages.  More...
  | 
|   | 
| int  | gnrc_netapi_dispatch (gnrc_nettype_t type, uint32_t demux_ctx, uint16_t cmd, gnrc_pktsnip_t *pkt) | 
|   | Sends cmd to all subscribers to (type, demux_ctx).  More...
  | 
|   | 
| static int  | gnrc_netapi_dispatch_send (gnrc_nettype_t type, uint32_t demux_ctx, gnrc_pktsnip_t *pkt) | 
|   | Sends a GNRC_NETAPI_MSG_TYPE_SND command to all subscribers to (type, demux_ctx).  More...
  | 
|   | 
| static int  | gnrc_netapi_receive (kernel_pid_t pid, gnrc_pktsnip_t *pkt) | 
|   | Shortcut function for sending GNRC_NETAPI_MSG_TYPE_RCV messages.  More...
  | 
|   | 
| static int  | gnrc_netapi_dispatch_receive (gnrc_nettype_t type, uint32_t demux_ctx, gnrc_pktsnip_t *pkt) | 
|   | Sends a GNRC_NETAPI_MSG_TYPE_RCV command to all subscribers to (type, demux_ctx).  More...
  | 
|   | 
| static int  | gnrc_netapi_get (kernel_pid_t pid, netopt_t opt, uint16_t context, void *data, size_t max_len) | 
|   | Shortcut function for sending GNRC_NETAPI_MSG_TYPE_GET messages and parsing the returned GNRC_NETAPI_MSG_TYPE_ACK message.  More...
  | 
|   | 
| static int  | gnrc_netapi_set (kernel_pid_t pid, netopt_t opt, uint16_t context, const void *data, size_t data_len) | 
|   | Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SET messages and parsing the returned GNRC_NETAPI_MSG_TYPE_ACK message.  More...
  | 
|   | 
◆ _gnrc_netapi_get_set()
      
        
          | int _gnrc_netapi_get_set  | 
          ( | 
          kernel_pid_t  | 
          pid,  | 
        
        
           | 
           | 
          netopt_t  | 
          opt,  | 
        
        
           | 
           | 
          uint16_t  | 
          context,  | 
        
        
           | 
           | 
          void *  | 
          data,  | 
        
        
           | 
           | 
          size_t  | 
          data_len,  | 
        
        
           | 
           | 
          uint16_t  | 
          type  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_GET or GNRC_NETAPI_MSG_TYPE_SET messages and parsing the returned GNRC_NETAPI_MSG_TYPE_ACK message. 
- Parameters
 - 
  
    | [in] | pid | PID of the targeted network module  | 
    | [in] | opt | option to get  | 
    | [in] | context | (optional) context to the given option  | 
    | [in] | data | pointer to buffer for reading the option's value  | 
    | [in] | data_len | (maximum) number of bytes in data  | 
    | [in] | type | type of the message to send. Must be either GNRC_NETAPI_MSG_TYPE_GET or GNRC_NETAPI_MSG_TYPE_SET | 
  
   
- Returns
 - value returned by the GNRC_NETAPI_MSG_TYPE_ACK message i.e. the actual length of the resulting data on success, a negative errno on error. The actual error value is for the implementation to decide but should be sensible to indicate what went wrong. 
 
 
 
◆ _gnrc_netapi_send_recv()
◆ gnrc_netapi_dispatch()
Sends cmd to all subscribers to (type, demux_ctx). 
- Parameters
 - 
  
    | [in] | type | protocol type of the targeted network module.  | 
    | [in] | demux_ctx | demultiplexing context for type.  | 
    | [in] | cmd | command for all subscribers  | 
    | [in] | pkt | pointer into the packet buffer holding the data to send | 
  
   
- Returns
 - Number of subscribers to (
type, demux_ctx).  
 
 
◆ gnrc_netapi_dispatch_receive()
Sends a GNRC_NETAPI_MSG_TYPE_RCV command to all subscribers to (type, demux_ctx). 
- Parameters
 - 
  
    | [in] | type | protocol type of the targeted network module.  | 
    | [in] | demux_ctx | demultiplexing context for type.  | 
    | [in] | pkt | pointer into the packet buffer holding the data to send | 
  
   
- Returns
 - Number of subscribers to (
type, demux_ctx).  
Definition at line 210 of file netapi.h.
 
 
◆ gnrc_netapi_dispatch_send()
Sends a GNRC_NETAPI_MSG_TYPE_SND command to all subscribers to (type, demux_ctx). 
- Parameters
 - 
  
    | [in] | type | protocol type of the targeted network module.  | 
    | [in] | demux_ctx | demultiplexing context for type.  | 
    | [in] | pkt | pointer into the packet buffer holding the data to send | 
  
   
- Returns
 - Number of subscribers to (
type, demux_ctx).  
Definition at line 180 of file netapi.h.
 
 
◆ gnrc_netapi_get()
  
  
      
        
          | static int gnrc_netapi_get  | 
          ( | 
          kernel_pid_t  | 
          pid,  | 
         
        
           | 
           | 
          netopt_t  | 
          opt,  | 
         
        
           | 
           | 
          uint16_t  | 
          context,  | 
         
        
           | 
           | 
          void *  | 
          data,  | 
         
        
           | 
           | 
          size_t  | 
          max_len  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_GET messages and parsing the returned GNRC_NETAPI_MSG_TYPE_ACK message. 
- Parameters
 - 
  
    | [in] | pid | PID of the targeted network module  | 
    | [in] | opt | option to get  | 
    | [in] | context | (optional) context to the given option  | 
    | [in] | data | pointer to buffer for reading the option's value  | 
    | [in] | max_len | maximum number of bytes that fit into data  | 
  
   
- Returns
 - value returned by the GNRC_NETAPI_MSG_TYPE_ACK message i.e. the actual length of the resulting data on success, a negative errno on error. The actual error value is for the implementation to decide but should be sensible to indicate what went wrong. 
 
Definition at line 231 of file netapi.h.
 
 
◆ gnrc_netapi_receive()
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_RCV messages. 
- Parameters
 - 
  
    | [in] | pid | PID of the targeted network module  | 
    | [in] | pkt | pointer into the packet buffer holding the received data | 
  
   
- Returns
 - 1 if packet was successfully delivered 
 
- 
-1 on error (invalid PID or no space in queue) 
 
Definition at line 195 of file netapi.h.
 
 
◆ gnrc_netapi_send()
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SND messages. 
- Parameters
 - 
  
    | [in] | pid | PID of the targeted network module  | 
    | [in] | pkt | pointer into the packet buffer holding the data to send | 
  
   
- Returns
 - 1 if packet was successfully delivered 
 
- 
-1 on error (invalid PID or no space in queue) 
 
Definition at line 152 of file netapi.h.
 
 
◆ gnrc_netapi_set()
  
  
      
        
          | static int gnrc_netapi_set  | 
          ( | 
          kernel_pid_t  | 
          pid,  | 
         
        
           | 
           | 
          netopt_t  | 
          opt,  | 
         
        
           | 
           | 
          uint16_t  | 
          context,  | 
         
        
           | 
           | 
          const void *  | 
          data,  | 
         
        
           | 
           | 
          size_t  | 
          data_len  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SET messages and parsing the returned GNRC_NETAPI_MSG_TYPE_ACK message. 
- Parameters
 - 
  
    | [in] | pid | PID of the targeted network module  | 
    | [in] | opt | option to set  | 
    | [in] | context | (optional) context to the given option  | 
    | [in] | data | data to set the given option to  | 
    | [in] | data_len | size of data  | 
  
   
- Returns
 - value returned by the GNRC_NETAPI_MSG_TYPE_ACK message i.e. 0 on success, a negative errno on error. The actual error value is for the implementation to decide but should be sensible to indicate what went wrong. 
 
Definition at line 253 of file netapi.h.