af_iucv.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. };
  67. struct iucv_sock_list {
  68. struct hlist_head head;
  69. rwlock_t lock;
  70. atomic_t autobind_name;
  71. };
  72. unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
  73. poll_table *wait);
  74. void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
  75. void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
  76. int iucv_sock_wait_state(struct sock *sk, int state, int state2,
  77. unsigned long timeo);
  78. int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
  79. void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
  80. void iucv_accept_unlink(struct sock *sk);
  81. struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
  82. #endif /* __IUCV_H */