af_iucv.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright 2006 IBM Corporation
  3. * IUCV protocol stack for Linux on zSeries
  4. * Version 1.0
  5. * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
  6. *
  7. */
  8. #ifndef __AFIUCV_H
  9. #define __AFIUCV_H
  10. #include <asm/types.h>
  11. #include <asm/byteorder.h>
  12. #include <linux/list.h>
  13. #include <linux/poll.h>
  14. #include <linux/socket.h>
  15. #ifndef AF_IUCV
  16. #define AF_IUCV 32
  17. #define PF_IUCV AF_IUCV
  18. #endif
  19. /* Connection and socket states */
  20. enum {
  21. IUCV_CONNECTED = 1,
  22. IUCV_OPEN,
  23. IUCV_BOUND,
  24. IUCV_LISTEN,
  25. IUCV_SEVERED,
  26. IUCV_DISCONN,
  27. IUCV_CLOSING,
  28. IUCV_CLOSED
  29. };
  30. #define IUCV_QUEUELEN_DEFAULT 65535
  31. #define IUCV_CONN_TIMEOUT (HZ * 40)
  32. #define IUCV_DISCONN_TIMEOUT (HZ * 2)
  33. #define IUCV_CONN_IDLE_TIMEOUT (HZ * 60)
  34. #define IUCV_BUFSIZE_DEFAULT 32768
  35. /* IUCV socket address */
  36. struct sockaddr_iucv {
  37. sa_family_t siucv_family;
  38. unsigned short siucv_port; /* Reserved */
  39. unsigned int siucv_addr; /* Reserved */
  40. char siucv_nodeid[8]; /* Reserved */
  41. char siucv_user_id[8]; /* Guest User Id */
  42. char siucv_name[8]; /* Application Name */
  43. };
  44. /* Common socket structures and functions */
  45. struct sock_msg_q {
  46. struct iucv_path *path;
  47. struct iucv_message msg;
  48. struct list_head list;
  49. spinlock_t lock;
  50. };
  51. #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
  52. struct iucv_sock {
  53. struct sock sk;
  54. char src_user_id[8];
  55. char src_name[8];
  56. char dst_user_id[8];
  57. char dst_name[8];
  58. struct list_head accept_q;
  59. spinlock_t accept_q_lock;
  60. struct sock *parent;
  61. struct iucv_path *path;
  62. struct sk_buff_head send_skb_q;
  63. struct sk_buff_head backlog_skb_q;
  64. struct sock_msg_q message_q;
  65. unsigned int send_tag;
  66. u8 flags;
  67. u16 msglimit;
  68. };
  69. /* iucv socket options (SOL_IUCV) */
  70. #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
  71. #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
  72. /* iucv related control messages (scm) */
  73. #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
  74. struct iucv_sock_list {
  75. struct hlist_head head;
  76. rwlock_t lock;
  77. atomic_t autobind_name;
  78. };
  79. unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
  80. poll_table *wait);
  81. void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
  82. void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
  83. int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
  84. void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
  85. void iucv_accept_unlink(struct sock *sk);
  86. struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
  87. #endif /* __IUCV_H */