1/* $NetBSD: notifications.h,v 1.2 2012/11/12 18:39:00 kefren Exp $ */
2
3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Mihai Chelaru <kefren@NetBSD.org>
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _NOTIFICATIONS_H_
33#define _NOTIFICATIONS_H_
34
35/* Notifications codes from RFC5036 3.9 - Status code summary */
36#define	NOTIF_SUCCESS			0x00000000
37#define	NOTIF_BAD_LDP_ID		0x00000001
38#define	NOTIF_BAD_LDP_VER		0x00000002
39#define	NOTIF_BAD_PDU_LEN		0x00000003
40#define	NOTIF_UNKNOWN_MESSAGE		0x00000004
41#define	NOTIF_BAD_MSG_LEN		0x00000005
42#define	NOTIF_UNKNOWN_TLV		0x00000006
43#define	NOTIF_BAD_TLV_LEN		0x00000007
44#define	NOTIF_MALFORMED_TLV_VALUE	0x00000008
45#define	NOTIF_HOLD_TIME_EXPIRED		0x00000009
46#define	NOTIF_SHUTDOWN			0x0000000A
47#define	NOTIF_LOOP_DETECTED		0x0000000B
48#define	NOTIF_UNKNOWN_FEC		0x0000000C
49#define	NOTIF_NO_ROUTE			0x0000000D
50#define	NOTIF_NO_LABEL_RESOURCES	0x0000000E
51#define	NOTIF_LABEL_RESOURCES_AVAIL	0x0000000F
52#define	NOTIF_SESSION_REJECTED_NO_HELLO	0x00000010
53#define	NOTIF_SESSION_REJECTED_ADV_MODE	0x00000011
54#define	NOTIF_SESSION_REJECTED_MAX_PDU	0x00000012
55#define	NOTIF_SESSION_REJECTED_LRANGE	0x00000013
56#define	NOTIF_KEEP_ALIVE_TIMER_EXPIRED	0x00000014
57#define	NOTIF_LABEL_REQUEST_ABORTED	0x00000015
58#define	NOTIF_MISSING_MESSAGE		0x00000016
59#define	NOTIF_UNSUPPORTED_AF		0x00000017
60#define	NOTIF_SESSION_REJECTED_BAD_KEEP	0x00000018
61#define	NOTIF_INTERNAL_ERROR		0x00000019
62
63#define	NOTIF_FATAL			0x80000000
64
65static const char	*NOTIF_STR[] __unused =
66{
67	"Success",
68	"Bad LDP ID",
69	"Bad LDP Version",
70	"Bad PDU Length",
71	"Unknown message",
72	"Bad message length",
73	"Unknown TLV",
74	"Bad TLV Length",
75	"Malformed TLV Value",
76	"Hold time expired",
77	"Shutdown",
78	"Loop detected",
79	"Unknown FEC",
80	"No route",
81	"No label resources",
82	"Label resources available",
83	"Session rejected: No hello",
84	"Session rejected: Parameters Advertising Mode",
85	"Session rejected: Max PDU Length",
86	"Session rejected: Label range",
87	"Keepalive timer expired",
88	"Label request aborted",
89	"Missing message",
90	"Unsupported Address Family",
91	"Session rejected: Bad keepalive time",
92	"Internal error"
93};
94
95struct notification_tlv* build_notification(uint32_t, uint32_t);
96int send_notification(const struct ldp_peer *, uint32_t, uint32_t);
97
98#endif	/* !_NOTIFICATIONS_H_ */
99