wimax-tools 1.4.4
|
00001 /* 00002 * Linux WiMax 00003 * i2400m specific helpers 00004 * 00005 * 00006 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. 00007 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * * Neither the name of Intel Corporation nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 #ifndef __wimaxll__i2400m_h__ 00036 #define __wimaxll__i2400m_h__ 00037 00038 #include <sys/types.h> 00039 #include <linux/wimax/i2400m.h> 00040 00041 struct i2400m; 00042 struct wimaxll_handle; 00043 00044 /* 00045 * Callback called by i2400m_msg_to_dev() when a reply to the executed 00046 * command arrives. 00047 * 00048 * In struct i2400m, the fields mt_cb_priv, mt_orig, and mt_orig_size are 00049 * set for reference. 00050 * 00051 * The callback is passed the reply and to only return some error 00052 * value that i2400m_msg_to_dev() will return to the caller. 00053 * 00054 * You CANNOT execute other commands with i2400m_msg_to_dev() inside 00055 * this function neither wait for reports to arrive. You'd deadlock. 00056 */ 00057 typedef int (*i2400m_reply_cb)( 00058 struct i2400m *, void *priv, 00059 const struct i2400m_l3l4_hdr *reply, size_t reply_size); 00060 00061 /** 00062 * Callback for handling i2400m reports. 00063 * 00064 * This function is called when the i2400m sends a report/indication. 00065 * 00066 * You cannot execute commands or wait for other reports from this 00067 * callback or it woul deadlock. You need to spawn off a thread or do 00068 * some other arrangement for it. 00069 * 00070 * @param i2400m i2400m device descriptor; use i2400m_priv() to obtain 00071 * the private pointer for it 00072 * @param l3l4 Pointer to the report data in L3L4 message format; note 00073 * this buffer is only valid in this execution context. Once the 00074 * callback returns, it will be destroyed. 00075 * @param l3l4_size Size of the buffer pointed to by l3l4. 00076 */ 00077 typedef void (*i2400m_report_cb)( 00078 struct i2400m *i2400m, 00079 const struct i2400m_l3l4_hdr *l3l4, size_t l3l4_size); 00080 00081 int i2400m_create(struct i2400m **, const char *, void *, i2400m_report_cb); 00082 int i2400m_create_from_handle(struct i2400m **, struct wimaxll_handle *, 00083 void *, i2400m_report_cb); 00084 void i2400m_destroy(struct i2400m *); 00085 int i2400m_msg_to_dev(struct i2400m *, const struct i2400m_l3l4_hdr *, size_t, 00086 i2400m_reply_cb, void *); 00087 void *i2400m_priv(struct i2400m *); 00088 struct wimaxll_handle *i2400m_wmx(struct i2400m *); 00089 00090 ssize_t i2400m_tlv_match( 00091 const struct i2400m_tlv_hdr *, enum i2400m_tlv, ssize_t); 00092 00093 const struct i2400m_tlv_hdr *i2400m_tlv_buffer_walk( 00094 const void *, size_t, const struct i2400m_tlv_hdr *); 00095 00096 const struct i2400m_tlv_hdr *i2400m_tlv_find( 00097 const struct i2400m_tlv_hdr *, size_t, enum i2400m_tlv, ssize_t); 00098 00099 #endif /* #define __wimaxll__i2400m_h__ */