(file) Return to addr.h CVS log (file) (dir) Up to [OMI] / omi / sock

 1 mike  1.1 /*
 2           **==============================================================================
 3           **
 4           ** Open Management Infrastructure (OMI)
 5           **
 6           ** Copyright (c) Microsoft Corporation
 7           ** 
 8           ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 9           ** use this file except in compliance with the License. You may obtain a copy 
10           ** of the License at 
11           **
12           **     http://www.apache.org/licenses/LICENSE-2.0 
13           **
14           ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15           ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
16           ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
17           ** MERCHANTABLITY OR NON-INFRINGEMENT. 
18           **
19           ** See the Apache 2 License for the specific language governing permissions 
20           ** and limitations under the License.
21           **
22 mike  1.1 **==============================================================================
23           */
24           
25           #ifndef _omi_addr_h
26           #define _omi_addr_h
27           
28           #include "config.h"
29           #include <string.h>
30           #include <common.h>
31           
32           BEGIN_EXTERNC
33           
34 krisbash 1.3 #if !defined(CONFIG_OS_WINDOWS)
35              # include <sys/socket.h>
36              # include <netdb.h>
37              # include <netinet/in.h>
38              #else
39              # include <winsock.h>
40              #endif
41              
42              #ifdef _PREFAST_
43              # pragma prefast (push)
44              # pragma prefast (disable: 24002)
45              #endif
46              
47 mike     1.1 typedef struct _Addr
48              {
49 krisbash 1.3     union padded_address
50                  {
51                      struct sockaddr sock_addr;      /* either a sockaddr_in or a sockaddr_in6 */
52                      unsigned char padding[128];     /* the padding used in Linux, > sizeof (sockaddr_in6) */
53                  } u;
54                  MI_Boolean is_ipv6;                 /* MI_TRUE if sa_family from u.sock_addr is AF_INET6 */
55                  MI_Uint16 port_high_endian;         /* a copy of sa_port from u.sock_addr */
56                  MI_Uint16 sock_addr_size;           /* a copy of af_size from u.sock_addr */
57 mike     1.1 }
58              Addr;
59              
60 krisbash 1.3 #ifdef _PREFAST_
61              # pragma prefast (pop)
62              #endif
63              
64 mike     1.1 MI_Result Addr_Init(
65                  Addr* self,
66                  const char* host,
67 krisbash 1.3     unsigned short port,
68                  MI_Boolean useSecondaryAddr);
69 mike     1.1 
70              void Addr_InitAny(
71                  Addr* self,
72                  unsigned short port);
73              
74              END_EXTERNC
75              
76              #endif /* _omi_addr_h */

ViewCVS 0.9.2