source: trunk/ORBit2-2.14.0/linc2/include/linc/linc-protocol.h

Last change on this file was 92, checked in by cinc, 19 years ago

Orbit2 modified for use with NOM

File size: 2.7 KB
Line 
1/*
2 * linc-protocol.h: This file is part of the linc library.
3 *
4 * Authors:
5 * Elliot Lee (sopwith@redhat.com)
6 * Michael Meeks (michael@ximian.com)
7 * Mark McLouglin (mark@skynet.ie) & others
8 *
9 * Copyright 2001, Red Hat, Inc., Ximian, Inc.,
10 * Sun Microsystems, Inc.
11 */
12#ifndef _LINK_PROTOCOL_H_
13#define _LINK_PROTOCOL_H_
14
15#include <glib/gmacros.h>
16
17G_BEGIN_DECLS
18
19#include <linc/linc-types.h>
20#include <sys/types.h>
21
22#ifdef G_OS_WIN32
23# include <winsock2.h>
24# undef interface /* #defined as struct! */
25#else
26# include <sys/socket.h>
27# include <netdb.h>
28#endif
29
30/* socklen_t seems rather un-portable */
31typedef unsigned int LinkSockLen;
32
33typedef enum {
34 LINK_PROTOCOL_SECURE = 1<<0,
35 LINK_PROTOCOL_NEEDS_BIND = 1<<1
36} LinkProtocolFlags;
37
38typedef void (*LinkProtocolSetupFunc) (int fd,
39 LinkConnectionOptions cnx_flags);
40typedef void (*LinkProtocolDestroyFunc) (int fd,
41 const char *host_info,
42 const char *serv_info);
43typedef struct sockaddr *(*LinkProtocolGetSockAddrFunc) (const LinkProtocolInfo *proto,
44 const char *hostname,
45 const char *service,
46 LinkSockLen *saddr_len);
47
48typedef gboolean (*LinkProtocolGetSockInfoFunc) (const LinkProtocolInfo *proto,
49 const struct sockaddr *sockaddr,
50 gchar **hostname,
51 gchar **service);
52
53typedef gboolean (*LinkProtocolIsLocal) (const LinkProtocolInfo *proto,
54 const struct sockaddr *sockaddr,
55 LinkSockLen saddr_len);
56
57struct _LinkProtocolInfo {
58 const char *name;
59 int family;
60 int addr_len;
61 int stream_proto_num;
62 LinkProtocolFlags flags;
63
64 LinkProtocolSetupFunc setup;
65 LinkProtocolDestroyFunc destroy;
66 LinkProtocolGetSockAddrFunc get_sockaddr;
67 LinkProtocolGetSockInfoFunc get_sockinfo;
68 LinkProtocolIsLocal is_local;
69 /* This structure is private and may be extended in future */
70 gpointer dummy[8];
71};
72
73typedef enum {
74 LINK_NET_ID_IS_LOCAL,
75 LINK_NET_ID_IS_SHORT_HOSTNAME,
76 LINK_NET_ID_IS_FQDN,
77 LINK_NET_ID_IS_IPADDR
78} LinkNetIdType;
79
80
81LinkProtocolInfo * const link_protocol_find (const char *name);
82LinkProtocolInfo * const link_protocol_find_num (const int family);
83LinkProtocolInfo * const link_protocol_all (void);
84char *link_get_tmpdir (void);
85void link_set_tmpdir (const char *dir);
86void link_use_local_hostname (LinkNetIdType use);
87const char* link_get_local_hostname (void);
88
89G_END_DECLS
90
91#endif /* _LINK_PROTOCOL_H_ */
Note: See TracBrowser for help on using the repository browser.