af_iucv.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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_CLOSED
  28. };
  29. #define IUCV_QUEUELEN_DEFAULT 65535
  30. #define IUCV_CONN_TIMEOUT (HZ * 40)
  31. #define IUCV_DISCONN_TIMEOUT (HZ * 2)
  32. #define IUCV_CONN_IDLE_TIMEOUT (HZ * 60)
  33. #define IUCV_BUFSIZE_DEFAULT 32768
  34. /* IUCV socket address */
  35. struct sockaddr_iucv {
  36. sa_family_t siucv_family;
  37. unsigned short siucv_port; /* Reserved */
  38. unsigned int siucv_addr; /* Reserved */
  39. char siucv_nodeid[8]; /* Reserved */
  40. char siucv_user_id[8]; /* Guest User Id */
  41. char siucv_name[8]; /* Application Name */
  42. };
  43. /* Common socket structures and functions */
  44. #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
  45. struct iucv_sock {
  46. struct sock sk;
  47. char src_user_id[8];
  48. char src_name[8];
  49. char dst_user_id[8];
  50. char dst_name[8];
  51. struct list_head accept_q;
  52. struct sock *parent;
  53. struct iucv_path *path;
  54. struct sk_buff_head send_skb_q;
  55. unsigned int send_tag;
  56. };
  57. struct iucv_sock_list {
  58. struct hlist_head head;
  59. rwlock_t lock;
  60. atomic_t autobind_name;
  61. };
  62. static void iucv_sock_destruct(struct sock *sk);
  63. static void iucv_sock_cleanup_listen(struct sock *parent);
  64. static void iucv_sock_kill(struct sock *sk);
  65. static void iucv_sock_close(struct sock *sk);
  66. static int iucv_sock_create(struct socket *sock, int proto);
  67. static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
  68. int addr_len);
  69. static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
  70. int alen, int flags);
  71. static int iucv_sock_listen(struct socket *sock, int backlog);
  72. static int iucv_sock_accept(struct socket *sock, struct socket *newsock,
  73. int flags);
  74. static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr,
  75. int *len, int peer);
  76. static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
  77. struct msghdr *msg, size_t len);
  78. static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
  79. struct msghdr *msg, size_t len, int flags);
  80. unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
  81. poll_table *wait);
  82. static int iucv_sock_release(struct socket *sock);
  83. static int iucv_sock_shutdown(struct socket *sock, int how);
  84. void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
  85. void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
  86. int iucv_sock_wait_state(struct sock *sk, int state, int state2,
  87. unsigned long timeo);
  88. int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
  89. void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
  90. void iucv_accept_unlink(struct sock *sk);
  91. struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
  92. #endif /* __IUCV_H */