Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
hresult.h
Go to the documentation of this file.
1 /*
2  Copyright 2011 John Selbie
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #ifndef HRESULT_H_
18 #define HRESULT_H_
19 
20 
21 // HRESULT
22 typedef int32_t HRESULT;
23 
24 #define SEVERITY_SUCCESS 0
25 #define SEVERITY_ERROR 1
26 
27 
28 #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
29 #define FAILED(hr) (((HRESULT)(hr)) < 0)
30 
31 #define SYSCALL_SUCCEEDED(x) (x!=-1)
32 #define SYSCALL_FAILED(x) (x == -1)
33 
34 #define HRESULT_CODE(hr) ((hr) & 0xFFFF)
35 #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff)
36 #define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)
37 #define MAKE_HRESULT(sev,fac,code) \
38  ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
39 
40 #define FACILITY_ERRNO 0x800
41 #define ERRNO_TO_HRESULT(err) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ERRNO, err)
42 #define ERRNOHR ERRNO_TO_HRESULT(ERRNO_TO_HRESULT(errno))
43 
44 
45 
46 #define S_OK ((HRESULT)0)
47 #define S_FALSE ((HRESULT)1L)
48 #define E_UNEXPECTED ((HRESULT)(0x8000FFFFL))
49 #define E_NOTIMPL ((HRESULT)(0x80004001L))
50 #define E_OUTOFMEMORY ((HRESULT)(0x8007000EL))
51 #define E_INVALIDARG ((HRESULT)(0x80070057L))
52 #define E_NOINTERFACE ((HRESULT)(0x80004002L))
53 #define E_POINTER ((HRESULT)(0x80004003L))
54 #define E_HANDLE ((HRESULT)(0x80070006L))
55 #define E_ABORT ((HRESULT)(0x80004004L))
56 #define E_FAIL ((HRESULT)(0x80004005L))
57 #define E_ACCESSDENIED ((HRESULT)(0x80070005L))
58 #define E_PENDING ((HRESULT)(0x8000000AL))
59 
60 
61 
62 
63 #endif /* HRESULT_H_ */
int32_t HRESULT
Definition: hresult.h:22