2014-06-13 01:52:06 +08:00
|
|
|
/****************************************************************************
|
2014-06-19 01:02:52 +08:00
|
|
|
* net/pkt/pkt_callback.c
|
2014-06-13 01:52:06 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2014-06-13 01:52:06 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-06-13 01:52:06 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08:00
|
|
|
* 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.
|
2014-06-13 01:52:06 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#if defined(CONFIG_NET) && defined(CONFIG_NET_PKT)
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2014-06-24 22:53:28 +08:00
|
|
|
#include <nuttx/net/netconfig.h>
|
2014-06-24 23:28:44 +08:00
|
|
|
#include <nuttx/net/netdev.h>
|
2014-06-13 01:52:06 +08:00
|
|
|
|
2014-06-29 08:07:02 +08:00
|
|
|
#include "devif/devif.h"
|
2014-06-26 00:34:52 +08:00
|
|
|
#include "pkt/pkt.h"
|
2014-06-13 01:52:06 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 06:33:14 +08:00
|
|
|
* Name: pkt_callback
|
2014-06-13 01:52:06 +08:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Inform the application holding the packet socket of a change in state.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if packet has been processed, otherwise ERROR.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2018-06-24 04:09:06 +08:00
|
|
|
* This function is called with the network locked.
|
2014-06-13 01:52:06 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-28 06:48:12 +08:00
|
|
|
uint16_t pkt_callback(FAR struct net_driver_s *dev,
|
2014-06-26 00:34:52 +08:00
|
|
|
FAR struct pkt_conn_s *conn, uint16_t flags)
|
2014-06-13 01:52:06 +08:00
|
|
|
{
|
2016-06-21 01:59:15 +08:00
|
|
|
ninfo("flags: %04x\n", flags);
|
2014-06-13 01:52:06 +08:00
|
|
|
|
|
|
|
/* Some sanity checking */
|
|
|
|
|
|
|
|
if (conn)
|
|
|
|
{
|
|
|
|
/* Perform the callback */
|
|
|
|
|
2015-05-29 02:01:38 +08:00
|
|
|
flags = devif_conn_event(dev, conn, flags, conn->list);
|
2014-06-13 01:52:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET && CONFIG_NET_PKT */
|