/*1* Copyright (C) ST-Ericsson AB 20102* Author: Sjur Brendeland/ [email protected]3* License terms: GNU General Public License (GPL) version 24*/56#ifndef CAIF_DEV_H_7#define CAIF_DEV_H_89#include <net/caif/caif_layer.h>10#include <net/caif/cfcnfg.h>11#include <linux/caif/caif_socket.h>12#include <linux/if.h>13#include <linux/net.h>1415/**16* struct caif_param - CAIF parameters.17* @size: Length of data18* @data: Binary Data Blob19*/20struct caif_param {21u16 size;22u8 data[256];23};2425/**26* struct caif_connect_request - Request data for CAIF channel setup.27* @protocol: Type of CAIF protocol to use (at, datagram etc)28* @sockaddr: Socket address to connect.29* @priority: Priority of the connection.30* @link_selector: Link selector (high bandwidth or low latency)31* @ifindex: kernel index of the interface.32* @param: Connect Request parameters (CAIF_SO_REQ_PARAM).33*34* This struct is used when connecting a CAIF channel.35* It contains all CAIF channel configuration options.36*/37struct caif_connect_request {38enum caif_protocol_type protocol;39struct sockaddr_caif sockaddr;40enum caif_channel_priority priority;41enum caif_link_selector link_selector;42int ifindex;43struct caif_param param;44};4546/**47* caif_connect_client - Connect a client to CAIF Core Stack.48* @config: Channel setup parameters, specifying what address49* to connect on the Modem.50* @client_layer: User implementation of client layer. This layer51* MUST have receive and control callback functions52* implemented.53* @ifindex: Link layer interface index used for this connection.54* @headroom: Head room needed by CAIF protocol.55* @tailroom: Tail room needed by CAIF protocol.56*57* This function connects a CAIF channel. The Client must implement58* the struct cflayer. This layer represents the Client layer and holds59* receive functions and control callback functions. Control callback60* function will receive information about connect/disconnect responses,61* flow control etc (see enum caif_control).62* E.g. CAIF Socket will call this function for each socket it connects63* and have one client_layer instance for each socket.64*/65int caif_connect_client(struct net *net,66struct caif_connect_request *conn_req,67struct cflayer *client_layer, int *ifindex,68int *headroom, int *tailroom);6970/**71* caif_disconnect_client - Disconnects a client from the CAIF stack.72*73* @client_layer: Client layer to be disconnected.74*/75int caif_disconnect_client(struct net *net, struct cflayer *client_layer);767778/**79* caif_client_register_refcnt - register ref-count functions provided by client.80*81* @adapt_layer: Client layer using CAIF Stack.82* @hold: Function provided by client layer increasing ref-count83* @put: Function provided by client layer decreasing ref-count84*85* Client of the CAIF Stack must register functions for reference counting.86* These functions are called by the CAIF Stack for every upstream packet,87* and must therefore be implemented efficiently.88*89* Client should call caif_free_client when reference count degrease to zero.90*/9192void caif_client_register_refcnt(struct cflayer *adapt_layer,93void (*hold)(struct cflayer *lyr),94void (*put)(struct cflayer *lyr));95/**96* caif_free_client - Free memory used to manage the client in the CAIF Stack.97*98* @client_layer: Client layer to be removed.99*100* This function must be called from client layer in order to free memory.101* Caller must guarantee that no packets are in flight upstream when calling102* this function.103*/104void caif_free_client(struct cflayer *adap_layer);105106#endif /* CAIF_DEV_H_ */107108109