modules/up/src/rpsl/rpsl/rpsl_policy.cc
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- print
- print
- print
- print
- print
- print
- print
- print
- print
1 // $Id: rpsl_policy.cc,v 1.1.1.1 2000/03/10 16:32:23 engin Exp $
2 //
3 // Copyright (c) 1994 by the University of Southern California
4 // All rights reserved.
5 //
6 // Permission to use, copy, modify, and distribute this software and its
7 // documentation in source and binary forms for lawful non-commercial
8 // purposes and without fee is hereby granted, provided that the above
9 // copyright notice appear in all copies and that both the copyright
10 // notice and this permission notice appear in supporting documentation,
11 // and that any documentation, advertising materials, and other materials
12 // related to such distribution and use acknowledge that the software was
13 // developed by the University of Southern California, Information
14 // Sciences Institute. The name of the USC may not be used to endorse or
15 // promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THE UNIVERSITY OF SOUTHERN CALIFORNIA DOES NOT MAKE ANY
19 // REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY
20 // PURPOSE. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
21 // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
22 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
23 // TITLE, AND NON-INFRINGEMENT.
24 //
25 // IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
26 // SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, WHETHER IN CONTRACT, TORT,
27 // OR OTHER FORM OF ACTION, ARISING OUT OF OR IN CONNECTION WITH, THE USE
28 // OR PERFORMANCE OF THIS SOFTWARE.
29 //
30 // Questions concerning this software should be directed to
31 // ratoolset@isi.edu.
32 //
33 // Author(s): Cengiz Alaettinoglu <cengiz@ISI.EDU>
34
35 #include "config.h"
36 #include <cstdio>
37 #include "rpsl_policy.hh"
38 #include "rpsl_attr.hh"
39
40 //// printing ////////////////////////////////////////////////////////
41
42 ostream& Policy::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
43 return out;
44 }
45
46 ostream &PolicyAction::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
47 out << rp_attr->name;
48 if (rp_method->isOperator)
49 out << " " << (rp_method->name + 8) << " " << *args;
50 else
51 out << "." << rp_method->name << "(" << *args << ")";
52
53 return out;
54 }
55
56 ostream &PolicyActionList::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
57 if (!isEmpty()) {
58 out << "action ";
59 for (PolicyAction *nd = head(); nd; nd = next(nd))
60 out << *nd << "; ";
61 }
62
63 return out;
64 }
65
66 ostream &PolicyPeeringAction::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
67 out << *peering << "\n";
68 if (!action->isEmpty())
69 out << " \t" << *action << "\n";
70 return out;
71 }
72
73 ostream &PolicyFactor::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
74 for (PolicyPeeringAction *pa = peeringActionList->head();
75 pa;
76 pa = peeringActionList->next(pa))
77 out << "\tfrom/to " << *pa << "\n";
78
79 out << " \taccept/announce " << *filter <<";";
80
81 return out;
82 }
83
84 ostream &PolicyTerm::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
85 bool indent = !isEmpty() && !isSingleton();
86 if (indent)
87 out << "{\n";
88
89 for (PolicyFactor *pf = head(); pf; pf = next(pf)) {
90 if (indent)
91 out << " ";
92 out << *pf << "\n";
93 }
94 if (indent)
95 out << "}";
96
97 return out;
98 }
99
100 ostream &PolicyRefine::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
101 out << *left << " refine " << *right;
102 return out;
103 }
104
105 ostream &PolicyExcept::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
106 out << *left << " except " << *right;
107 return out;
108 }
109
110
111 ostream &PolicyPeering::print(ostream &out) const {
/* [<][>][^][v][top][bottom][index][help] */
112 if (prngSet)
113 out << prngSet;
114 else {
115 out << *peerASes;
116 if (peerRtrs)
117 out << " " << *peerRtrs;
118 if (localRtrs)
119 out << " at " << localRtrs;
120 }
121
122 return out;
123 }
124