connection.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: connection.h /main/1 1996/04/21 19:22:23 drk $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company
  26. * (c) Copyright 1993, 1994 International Business Machines Corp.
  27. * (c) Copyright 1993, 1994 Novell, Inc.
  28. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. */
  30. #ifndef _CONNECTION_H
  31. #define _CONNECTION_H
  32. #include <rpc/rpc.h>
  33. #include "ansi_c.h"
  34. #include "csa.h"
  35. #define _DtCM_DEFAULT_TIMEOUT 5
  36. #define _DtCM_INITIAL_TIMEOUT 25
  37. #define _DtCM_LONG_TIMEOUT 60
  38. #define DAYSEC 86400
  39. typedef enum Transport_type
  40. {
  41. tcp_transport,
  42. udp_transport
  43. } _DtCm_Transport_Type;
  44. typedef struct targetlist {
  45. char *cal;
  46. unsigned long update_type;
  47. struct targetlist *next;
  48. } _DtCm_Target_List;
  49. typedef struct cl_info {
  50. char *host;
  51. CLIENT *tcpcl;
  52. CLIENT *udpcl;
  53. u_long vers_out;
  54. long last_used;
  55. int nregistered;
  56. _DtCm_Target_List *tlist;
  57. struct cl_info *next;
  58. struct cl_info *prev;
  59. } _DtCm_Client_Info;
  60. typedef struct conn {
  61. _DtCm_Client_Info *ci;
  62. int retry;
  63. _DtCm_Transport_Type use;
  64. enum clnt_stat stat;
  65. } _DtCm_Connection;
  66. extern enum clnt_stat _DtCm_clnt_call(
  67. _DtCm_Connection *conn,
  68. u_long proc,
  69. xdrproc_t inproc,
  70. caddr_t in,
  71. xdrproc_t outproc,
  72. caddr_t out,
  73. struct timeval tout);
  74. extern CSA_return_code _DtCm_add_registration(
  75. _DtCm_Client_Info *ci,
  76. char *cal,
  77. unsigned long update_type);
  78. extern void _DtCm_remove_registration(
  79. _DtCm_Client_Info *ci,
  80. char *cal);
  81. extern CSA_return_code _DtCm_create_udp_client(
  82. char *host,
  83. int version,
  84. int timeout,
  85. _DtCm_Client_Info **clnt);
  86. extern CSA_return_code _DtCm_create_tcp_client(
  87. char *host,
  88. int version,
  89. int timeout,
  90. _DtCm_Client_Info **clnt);
  91. extern CSA_return_code _DtCm_get_server_rpc_version(char *host, int *vers);
  92. extern CSA_return_code _DtCm_clntstat_to_csastat(enum clnt_stat clntstat);
  93. #endif