af_iucv.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
  46. struct iucv_sock {
  47. struct sock sk;
  48. char src_user_id[8];
  49. char src_name[8];
  50. char dst_user_id[8];
  51. char dst_name[8];
  52. struct list_head accept_q;
  53. struct sock *parent;
  54. struct iucv_path *path;
  55. struct sk_buff_head send_skb_q;
  56. struct sk_buff_head backlog_skb_q;
  57. unsigned int send_tag;
  58. };
  59. struct iucv_sock_list {
  60. struct hlist_head head;
  61. rwlock_t lock;
  62. atomic_t autobind_name;
  63. };
  64. static void iucv_sock_destruct(struct sock *sk);
  65. static void iucv_sock_cleanup_listen(struct sock *parent);
  66. static void iucv_sock_kill(struct sock *sk);
  67. static void iucv_sock_close(struct sock *sk);
  68. static int iucv_sock_create(struct socket *sock, int proto);
  69. static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
  70. int addr_len);
  71. static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
  72. int alen, int flags);
  73. static int iucv_sock_listen(struct socket *sock, int backlog);
  74. static int iucv_sock_accept(struct socket *sock, struct socket *newsock,
  75. int flags);
  76. static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr,
  77. int *len, int peer);
  78. static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
  79. struct msghdr *msg, size_t len);
  80. static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
  81. struct msghdr *msg, size_t len, int flags);
  82. unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
  83. poll_table *wait);
  84. static int iucv_sock_release(struct socket *sock);
  85. static int iucv_sock_shutdown(struct socket *sock, int how);
  86. void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
  87. void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
  88. int iucv_sock_wait_state(struct sock *sk, int state, int state2,
  89. unsigned long timeo);
  90. int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
  91. void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
  92. void iucv_accept_unlink(struct sock *sk);
  93. struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
  94. #endif /* __IUCV_H */