~ubuntu-branches/ubuntu/karmic/firebird2.1/karmic

« back to all changes in this revision

Viewing changes to src/jrd/msg_encode.h

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2008-05-26 23:59:25 UTC
  • Revision ID: james.westby@ubuntu.com-20080526235925-2pnqj6nxpppoeaer
Tags: upstream-2.1.0.17798-0.ds2
ImportĀ upstreamĀ versionĀ 2.1.0.17798-0.ds2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      PROGRAM:        JRD Access Method
 
3
 *      MODULE:         msg_encode.h    
 
4
 *      DESCRIPTION:    Message encoding definition file
 
5
 *
 
6
 * The contents of this file are subject to the Interbase Public
 
7
 * License Version 1.0 (the "License"); you may not use this file
 
8
 * except in compliance with the License. You may obtain a copy
 
9
 * of the License at http://www.Inprise.com/IPL.html
 
10
 *
 
11
 * Software distributed under the License is distributed on an
 
12
 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
 
13
 * or implied. See the License for the specific language governing
 
14
 * rights and limitations under the License.
 
15
 *
 
16
 * The Original Code was created by Inprise Corporation
 
17
 * and its predecessors. Portions created by Inprise Corporation are
 
18
 * Copyright (C) Inprise Corporation.
 
19
 *
 
20
 * All Rights Reserved.
 
21
 * Contributor(s): ______________________________________.
 
22
 */
 
23
#ifndef MSG_ENCODE_H
 
24
#define MSG_ENCODE_H
 
25
 
 
26
const ISC_STATUS ISC_MASK       = 0x14000000;   /* Defines the code as a valid ISC code */
 
27
const ISC_STATUS FAC_MASK       = 0x00FF0000;   /* Specifies the facility where the code is located */
 
28
const ISC_STATUS CODE_MASK      = 0x0000FFFF;   /* Specifies the code in the message file */
 
29
const ISC_STATUS CLASS_MASK     = 0xF0000000;   /* Defines the code as warning, error, info, or other */
 
30
 
 
31
/* The following definitions can be used to specify the context in
 
32
 * which a status code is used.
 
33
 */
 
34
//#define CLASS_ERROR           0L              /* Code represents an error */
 
35
//#define CLASS_WARNING         1L      /* Code represents a warning */
 
36
//#define CLASS_INFO            2L              /* Code represents an information msg */
 
37
 
 
38
//#define MAKE_ERROR(code)      (code | (CLASS_ERROR & 0x3L) << 30)
 
39
//#define MAKE_WARNING(code)    (code | (CLASS_WARNING & 0x3L) << 30)
 
40
//#define MAKE_INFO(code)               (code | (CLASS_INFO & 0x3L) << 30)
 
41
 
 
42
/* The procedure for encoding an error message is as follows:
 
43
 * Be sure to update gds.c::gds__decode if this calculation changes
 
44
 * since gds__decode returns the error code, facility, and error type
 
45
 * from a given error message */
 
46
 
 
47
#define ENCODE_ISC_MSG(code, facility)  ((facility & 0x1F) << 16) | \
 
48
                                        ((code & 0x3FFF) << 0) | \
 
49
                                        (ISC_MASK)
 
50
 
 
51
#define GET_FACILITY(code)              (code & FAC_MASK) >> 16
 
52
#define GET_CLASS(code)                 (code & CLASS_MASK) >> 30
 
53
#define GET_CODE(code)                  (code & CODE_MASK) >> 0
 
54
 
 
55
#endif // MSG_ENCODE_H