proto_extern.h 10.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.0  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

22 23 24 25
/***************************************************************************
                          nas_proto_extern.h  -  description
                             -------------------
    copyright            : (C) 2002 by Eurecom
26 27
    email                : navid.nikaein@eurecom.fr
                           lionel.gauthier@eurecom.fr
28
                           knopp@eurecom.fr
29

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
***************************************************************************/

#ifndef _NAS_PROTO_H
#define _NAS_PROTO_H

#include <linux/if_arp.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/ipv6.h>
#include <linux/ip.h>
#include <linux/sysctl.h>
#include <linux/timer.h>
#include <asm/param.h>
//#include <sys/sysctl.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/icmp.h>
#include <linux/icmpv6.h>
#include <linux/in.h>
#include <net/ndisc.h>

//#include "rrc_nas_primitives.h"
//#include "protocol_vars_extern.h"
//#include "as_sap.h"
//#include "rrc_qos.h"
//#include "rrc_sap.h"

#include "local.h"

// device.c


/** @defgroup _nas_mesh_impl_ NAS Mesh Network Device
* @ingroup _ref_implementation_
* @{
\fn int find_inst(struct net_device *dev)
\brief This function determines the instance id for a particular device pointer.
@param dev Pointer to net_device structure
 */
int find_inst(struct net_device *dev);

// nas_common.c
/**
\fn void nas_COMMON_receive(unsigned short dlen, void* pdcp_sdu,int inst,struct classifier_entity *rclass,nasRadioBearerId_t rb_id)
\brief Receive data from FIFO (QOS)
@param dlen Length of SDU in bytes
@param pdcp_sdu Pointer to received SDU
@param inst Instance number
@param rclass RX Classifier entity
@param rb_id Radio Bearer Id
 */
83 84 85 86 87
void nas_COMMON_receive(unsigned short dlen,
                        void *pdcp_sdu,
                        int inst,
                        struct classifier_entity *rclass,
                        nasRadioBearerId_t rb_id);
88 89 90 91 92 93 94 95 96

/**
\fn void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst)
\brief Request the transfer of data (QoS SAP)
@param skb pointer to socket buffer
@param cx pointer to connection entity for SDU
@param gc pointer to classifier entity for SDU
@param inst device instance
 */
97 98
void nas_COMMON_QOS_send(struct sk_buff *skb,
                         struct cx_entity *cx,
99
                         struct classifier_entity *gc,int inst, struct nas_priv *gpriv);
100 101 102 103 104 105 106 107 108

/**
\fn void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst)
\brief  Delete the data
@param skb pointer to socket buffer
@param cx pointer to connection entity for SDU
@param gc pointer to classifier entity for SDU
@param inst device instance
 */
109 110
void nas_COMMON_del_send(struct sk_buff *skb,
                         struct cx_entity *cx,
111
                         struct classifier_entity *gc,int inst, struct nas_priv *gpriv);
112

113
#ifndef PDCP_USE_NETLINK
114 115 116 117 118
/**
\fn void nas_COMMON_QOS_receive()
\brief Retrieve PDU from PDCP for connection
 */
void nas_COMMON_QOS_receive(void);
119
#endif //PDCP_USE_NETLINK
120 121 122 123 124 125 126 127

/**
\fn struct rb_entity *nas_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos)
\brief Add a radio-bearer descriptor
@param cx pointer to connection entity
@param rabi radio-bearer index
@param qos NAS QOS traffic class
 */
128 129 130
struct rb_entity *nas_COMMON_add_rb(
  struct cx_entity *cx, nasRadioBearerId_t rabi,
  nasQoSTrafficClass_t qos);
131 132 133 134 135 136 137 138

/**
\fn struct rb_entity *nas_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rabi)
\brief Search for a radio-bearer entity for a particular connection and radio-bearer index
@param cx pointer to connection entity
@param rabi radio-bearer index
@returns A pointer to the radio-bearer entity
 */
139 140
struct rb_entity *nas_COMMON_search_rb(
  struct cx_entity *cx, nasRadioBearerId_t rabi);
141 142 143 144 145 146 147 148

/**
\fn struct cx_entity *nas_COMMON_search_cx(nasLocalConnectionRef_t lcr,struct nas_priv *gpriv)
\brief  Search for a connection entity based on its index and pointer to nas_priv
@param lcr index of local connection
@param gpriv pointer to nas_priv for device
@returns A pointer to the connection entity
 */
149 150 151
struct cx_entity *nas_COMMON_search_cx(
  nasLocalConnectionRef_t lcr,
  struct nas_priv *gpriv);
152 153 154 155 156 157 158 159

/**
\fn struct classifier_entity *nas_COMMON_search_class_for_rb(nasRadioBearerId_t rab_id,struct nas_priv *priv)
\brief  Search for an RX classifier entity based on a RB id and pointer to nas_priv
@param rab_id Index of RAB for search
@param priv pointer to nas_priv for device
@returns A pointer to the corresponding RX classifier entity
 */
160 161 162
struct classifier_entity
*nas_COMMON_search_class_for_rb(nasRadioBearerId_t
                                rab_id,struct nas_priv *priv);
163 164 165 166 167 168 169 170

/**
\fn void nas_COMMON_flush_rb(struct cx_entity *cx)
\brief Clear all RB's for a particular connection
@param cx pointer to connection entity
 */
void nas_COMMON_flush_rb(struct cx_entity *cx);

171
#ifdef PDCP_USE_NETLINK
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
/**
\fn int nas_netlink_send(unsigned char *data,unsigned int len)
\brief Request the transfer of data by PDCP via netlink socket
@param data pointer to SDU
@param len length of SDU in bytes
@returns Numeber of bytes transfered by netlink socket
 */
int nas_netlink_send(unsigned char *data,unsigned int len);

/**
\fn void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
\brief Request a PDU from PDCP
@param nlh pointer to netlink message header
 */
void nas_COMMON_QOS_receive(struct nlmsghdr *nlh);

188
#endif //PDCP_USE_NETLINK
189 190
//nasmesh.c

191
/**
192 193 194 195
  \brief Initialize an interface for a particular instance ID.
*/
void nas_mesh_init(int inst   //!< Instance ID

196
                  );
197

198
void nas_mesh_timer(unsigned long data);
199 200 201 202 203

int  nas_mesh_DC_receive(struct cx_entity *cx,struct nas_priv *gpriv);
int  nas_mesh_GC_receive(struct nas_priv *gpriv);
int  nas_mesh_DC_send_cx_establish_request(struct cx_entity *cx,struct nas_priv *gpriv);
int  nas_mesh_DC_send_cx_release_request(struct cx_entity *cx,struct nas_priv *gpriv);
204
void nas_mesh_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst, struct nas_priv *gpriv);
205 206

// iocontrol.c
207 208
void nas_CTL_send(struct sk_buff *skb,
                  struct cx_entity *cx,
209
                  struct classifier_entity *gc,int inst, struct nas_priv *gpriv);
210
//int nas_CTL_receive_authentication(struct ipv6hdr *iph, struct cx-entity *cx, unsigned char sapi);
211 212
int nas_CTL_ioctl(struct net_device *dev,
                  struct ifreq *ifr, int cmd);
213 214 215

// classifier.c

216
/**
217 218 219
  \brief Send a socket received from IP to classifier for a particular instance ID.
*/
void nas_CLASS_send(struct sk_buff *skb,    //!< Pointer to socket buffer
220 221 222
                    int inst                //!< Instance ID
                   );
/**
223 224 225 226
  \brief
*/
struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, unsigned char dscp, unsigned short classref);

227
/**
228 229
  \brief Send a socket received from IP to classifier for a particular instance ID.
*/
230 231
struct classifier_entity
*nas_CLASS_add_fclassifier(struct cx_entity *cx,
232 233 234
    unsigned char dscp,
    unsigned short classref
                                                   );
235

236
/**
237 238
  \brief Send a socket received from IP to classifier for a particular instance ID.
*/
239 240
struct classifier_entity
*nas_CLASS_add_rclassifier(unsigned char dscp,
241 242 243
    unsigned short classref,
    struct nas_priv*
                                                   );
244

245 246
/**
  \brief
247
*/
248 249 250 251
void nas_CLASS_del_sclassifier(struct cx_entity *cx,
                               unsigned char dscp,
                               unsigned short classref
                              );
252

253 254
/**
  \brief
255
*/
256 257 258 259
void nas_CLASS_del_fclassifier(struct cx_entity *cx,
                               unsigned char dscp,
                               unsigned short classref
                              );
260

261 262
/**
  \brief
263
*/
264 265 266 267
void nas_CLASS_del_rclassifier(unsigned char dscp,
                               unsigned short classref,
                               struct nas_priv*
                              );
268

269 270
/**
  \brief
271 272
*/
void nas_CLASS_flush_sclassifier(struct cx_entity *cx
273
                                );
274

275 276
/**
  \brief
277 278
*/
void nas_CLASS_flush_fclassifier(struct cx_entity *cx
279
                                );
280

281 282
/**
  \brief
283 284
*/
void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv
285
                                );
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308


// nas_tool.c
unsigned char nas_TOOL_invfct(struct classifier_entity *gc);
void nas_TOOL_fct(struct classifier_entity *gc, unsigned char fct);
void nas_TOOL_imei2iid(unsigned char *imei, unsigned char *iid);
unsigned char nas_TOOL_get_dscp6(struct ipv6hdr *iph);
unsigned char nas_TOOL_get_dscp4(struct iphdr *iph);
unsigned char *nas_TOOL_get_protocol6(struct ipv6hdr *iph, unsigned char *protocol);
unsigned char *nas_TOOL_get_protocol4(struct iphdr *iph, unsigned char *protocol);
char *nas_TOOL_get_udpmsg(struct udphdr *udph);
unsigned short nas_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, unsigned char proto, unsigned int udplen, void *data);
int nas_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, unsigned char plen);
int nas_TOOL_network4(unsigned int *addr, unsigned int *prefix, unsigned char plen);
void print_TOOL_pk_icmp6(struct icmp6hdr *icmph);

void print_TOOL_pk_all(struct sk_buff *skb);
void print_TOOL_pk_ipv6(struct ipv6hdr *iph);
void print_TOOL_state(unsigned char state);
void nas_tool_print_buffer(char * buffer,int length);
void nas_print_rb_entity(struct rb_entity *rb);
void nas_print_classifier(struct classifier_entity *gc);

309
#ifdef PDCP_USE_NETLINK
310 311 312 313 314 315 316 317 318
// nas_netlink.c

void nas_netlink_release(void);
int nas_netlink_init(void);

#endif

/** @} */
#endif