dn.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _LINUX_DN_H
  3. #define _LINUX_DN_H
  4. #include <linux/ioctl.h>
  5. #include <linux/types.h>
  6. #include <linux/if_ether.h>
  7. /*
  8. DECnet Data Structures and Constants
  9. */
  10. /*
  11. * DNPROTO_NSP can't be the same as SOL_SOCKET,
  12. * so increment each by one (compared to ULTRIX)
  13. */
  14. #define DNPROTO_NSP 2 /* NSP protocol number */
  15. #define DNPROTO_ROU 3 /* Routing protocol number */
  16. #define DNPROTO_NML 4 /* Net mgt protocol number */
  17. #define DNPROTO_EVL 5 /* Evl protocol number (usr) */
  18. #define DNPROTO_EVR 6 /* Evl protocol number (evl) */
  19. #define DNPROTO_NSPT 7 /* NSP trace protocol number */
  20. #define DN_ADDL 2
  21. #define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */
  22. #define DN_MAXOPTL 16
  23. #define DN_MAXOBJL 16
  24. #define DN_MAXACCL 40
  25. #define DN_MAXALIASL 128
  26. #define DN_MAXNODEL 256
  27. #define DNBUFSIZE 65023
  28. /*
  29. * SET/GET Socket options - must match the DSO_ numbers below
  30. */
  31. #define SO_CONDATA 1
  32. #define SO_CONACCESS 2
  33. #define SO_PROXYUSR 3
  34. #define SO_LINKINFO 7
  35. #define DSO_CONDATA 1 /* Set/Get connect data */
  36. #define DSO_DISDATA 10 /* Set/Get disconnect data */
  37. #define DSO_CONACCESS 2 /* Set/Get connect access data */
  38. #define DSO_ACCEPTMODE 4 /* Set/Get accept mode */
  39. #define DSO_CONACCEPT 5 /* Accept deferred connection */
  40. #define DSO_CONREJECT 6 /* Reject deferred connection */
  41. #define DSO_LINKINFO 7 /* Set/Get link information */
  42. #define DSO_STREAM 8 /* Set socket type to stream */
  43. #define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */
  44. #define DSO_MAXWINDOW 11 /* Maximum window size allowed */
  45. #define DSO_NODELAY 12 /* Turn off nagle */
  46. #define DSO_CORK 13 /* Wait for more data! */
  47. #define DSO_SERVICES 14 /* NSP Services field */
  48. #define DSO_INFO 15 /* NSP Info field */
  49. #define DSO_MAX 15 /* Maximum option number */
  50. /* LINK States */
  51. #define LL_INACTIVE 0
  52. #define LL_CONNECTING 1
  53. #define LL_RUNNING 2
  54. #define LL_DISCONNECTING 3
  55. #define ACC_IMMED 0
  56. #define ACC_DEFER 1
  57. #define SDF_WILD 1 /* Wild card object */
  58. #define SDF_PROXY 2 /* Addr eligible for proxy */
  59. #define SDF_UICPROXY 4 /* Use uic-based proxy */
  60. /* Structures */
  61. struct dn_naddr {
  62. __le16 a_len;
  63. __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */
  64. };
  65. struct sockaddr_dn {
  66. __u16 sdn_family;
  67. __u8 sdn_flags;
  68. __u8 sdn_objnum;
  69. __le16 sdn_objnamel;
  70. __u8 sdn_objname[DN_MAXOBJL];
  71. struct dn_naddr sdn_add;
  72. };
  73. #define sdn_nodeaddrl sdn_add.a_len /* Node address length */
  74. #define sdn_nodeaddr sdn_add.a_addr /* Node address */
  75. /*
  76. * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure
  77. */
  78. struct optdata_dn {
  79. __le16 opt_status; /* Extended status return */
  80. #define opt_sts opt_status
  81. __le16 opt_optl; /* Length of user data */
  82. __u8 opt_data[16]; /* User data */
  83. };
  84. struct accessdata_dn {
  85. __u8 acc_accl;
  86. __u8 acc_acc[DN_MAXACCL];
  87. __u8 acc_passl;
  88. __u8 acc_pass[DN_MAXACCL];
  89. __u8 acc_userl;
  90. __u8 acc_user[DN_MAXACCL];
  91. };
  92. /*
  93. * DECnet logical link information structure
  94. */
  95. struct linkinfo_dn {
  96. __u16 idn_segsize; /* Segment size for link */
  97. __u8 idn_linkstate; /* Logical link state */
  98. };
  99. /*
  100. * Ethernet address format (for DECnet)
  101. */
  102. union etheraddress {
  103. __u8 dne_addr[ETH_ALEN]; /* Full ethernet address */
  104. struct {
  105. __u8 dne_hiord[4]; /* DECnet HIORD prefix */
  106. __u8 dne_nodeaddr[2]; /* DECnet node address */
  107. } dne_remote;
  108. };
  109. /*
  110. * DECnet physical socket address format
  111. */
  112. struct dn_addr {
  113. __le16 dna_family; /* AF_DECnet */
  114. union etheraddress dna_netaddr; /* DECnet ethernet address */
  115. };
  116. #define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */
  117. #define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr)
  118. #define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr)
  119. #define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int)
  120. #define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int)
  121. #endif /* _LINUX_DN_H */