Back to home page

OSCL-LXR

 
 

    


0001 /*
0002    CMTP implementation for Linux Bluetooth stack (BlueZ).
0003    Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
0004 
0005    This program is free software; you can redistribute it and/or modify
0006    it under the terms of the GNU General Public License version 2 as
0007    published by the Free Software Foundation;
0008 
0009    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0010    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0011    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
0012    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
0013    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
0014    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0015    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0016    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0017 
0018    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
0019    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
0020    SOFTWARE IS DISCLAIMED.
0021 */
0022 
0023 #ifndef __CMTP_H
0024 #define __CMTP_H
0025 
0026 #include <linux/types.h>
0027 #include <net/bluetooth/bluetooth.h>
0028 
0029 #define BTNAMSIZ 21
0030 
0031 /* CMTP ioctl defines */
0032 #define CMTPCONNADD _IOW('C', 200, int)
0033 #define CMTPCONNDEL _IOW('C', 201, int)
0034 #define CMTPGETCONNLIST _IOR('C', 210, int)
0035 #define CMTPGETCONNINFO _IOR('C', 211, int)
0036 
0037 #define CMTP_LOOPBACK   0
0038 
0039 struct cmtp_connadd_req {
0040     int   sock; /* Connected socket */
0041     __u32 flags;
0042 };
0043 
0044 struct cmtp_conndel_req {
0045     bdaddr_t bdaddr;
0046     __u32    flags;
0047 };
0048 
0049 struct cmtp_conninfo {
0050     bdaddr_t bdaddr;
0051     __u32    flags;
0052     __u16    state;
0053     int      num;
0054 };
0055 
0056 struct cmtp_connlist_req {
0057     __u32  cnum;
0058     struct cmtp_conninfo __user *ci;
0059 };
0060 
0061 int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock);
0062 int cmtp_del_connection(struct cmtp_conndel_req *req);
0063 int cmtp_get_connlist(struct cmtp_connlist_req *req);
0064 int cmtp_get_conninfo(struct cmtp_conninfo *ci);
0065 
0066 /* CMTP session defines */
0067 #define CMTP_INTEROP_TIMEOUT    (HZ * 5)
0068 #define CMTP_INITIAL_MSGNUM 0xff00
0069 
0070 struct cmtp_session {
0071     struct list_head list;
0072 
0073     struct socket *sock;
0074 
0075     bdaddr_t bdaddr;
0076 
0077     unsigned long state;
0078     unsigned long flags;
0079 
0080     uint mtu;
0081 
0082     char name[BTNAMSIZ];
0083 
0084     atomic_t terminate;
0085     struct task_struct *task;
0086 
0087     wait_queue_head_t wait;
0088 
0089     int ncontroller;
0090     int num;
0091     struct capi_ctr ctrl;
0092 
0093     struct list_head applications;
0094 
0095     unsigned long blockids;
0096     int msgnum;
0097 
0098     struct sk_buff_head transmit;
0099 
0100     struct sk_buff *reassembly[16];
0101 };
0102 
0103 struct cmtp_application {
0104     struct list_head list;
0105 
0106     unsigned long state;
0107     int err;
0108 
0109     __u16 appl;
0110     __u16 mapping;
0111 
0112     __u16 msgnum;
0113 };
0114 
0115 struct cmtp_scb {
0116     int id;
0117     int data;
0118 };
0119 
0120 int  cmtp_attach_device(struct cmtp_session *session);
0121 void cmtp_detach_device(struct cmtp_session *session);
0122 
0123 void cmtp_recv_capimsg(struct cmtp_session *session, struct sk_buff *skb);
0124 
0125 /* CMTP init defines */
0126 int cmtp_init_sockets(void);
0127 void cmtp_cleanup_sockets(void);
0128 
0129 #endif /* __CMTP_H */