## modules/up/src/rpsl/rpsl/rpsl_filter.cc

/* [<][>][^][v][top][bottom][index][help] */

## FUNCTIONS

This source file includes following functions.

1. print
2. print
3. print
4. print
5. print
6. print
7. print
8. print
9. print
10. print
11. print
12. print
13. print
14. print
15. print
16. print
17. print
18. print
19. print
20. print

       1 //  $Id: rpsl_filter.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_filter.hh"
      38 #include "rpsl_attr.hh"
      39 #include "regexp.hh"
      40
      41 //// printing ////////////////////////////////////////////////////////
      42
      43 ostream &Filter::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      44    return out;
      45 }
      46
      47 ostream &FilterMS::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      48    out << *f1;
      49    switch (code) {
      50    case 0:
      51       out << "^-";
      52       break;
      53    case 1:
      54       out << "^+";
      55       break;
      56    case 2:
      57       if (n == m)
      58          out << "^" << n;
      59       else
      60          out << "^" << n << "-" << m;
      61    }
      62    return out;
      63 }
      64
      65 ostream &FilterOR::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      66    out << *f1 << " or " << *f2;
      67    return out;
      68 }
      69
      70 ostream &FilterAND::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      71    out << *f1 << " and " << *f2;
      72    return out;
      73 }
      74
      75 ostream &FilterEXCEPT::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      76    out << *f1 << " except " << *f2;
      77    return out;
      78 }
      79
      80 ostream &FilterNOT::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      81    out << "not " << *f1;
      82    return out;
      83 }
      84
      85 ostream &FilterASNO::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      86    out << "AS" << asno;
      87    return out;
      88 }
      89
      90 ostream &FilterASNAME::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      91    out << asname;
      92    return out;
      93 }
      94
      95 ostream &FilterRSNAME::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
      96    out << rsname;
      97    return out;
      98 }
      99
     100 ostream &FilterRTRSNAME::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     101    out << rtrsname;
     102    return out;
     103 }
     104
     105 ostream &FilterFLTRNAME::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     106    out << fltrname;
     107    return out;
     108 }
     109
     110 ostream &FilterANY::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     111    out << "ANY";
     112    return out;
     113 }
     114
     115 ostream &FilterPeerAS::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     116    out << "peerAS";
     117    return out;
     118 }
     119
     120 ostream &FilterASPath::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     121    out << "<" << *re << ">";
     122    return out;
     123 }
     124
     125 ostream &FilterPRFXList::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     126    out << "{";
     127    int i = low();
     128    if (i < fence()) {
     129       out << (*this)[i].get_text();
     130       for (++i; i < fence(); ++i)
     131          out << ", " << (*this)[i].get_text();
     132    }
     133    out << "}";
     134
     135    return out;
     136 }
     137
     138 ostream &FilterRPAttribute::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     139    out << rp_attr->name;
     140    if (rp_method->isOperator)
     141       out << " " << (rp_method->name + 8) << " " << *args;
     142    else
     143       out << "." << rp_method->name << "(" << *args << ")";
     144
     145    return out;
     146 }
     147
     148 ostream &FilterHAVE_COMPONENTS::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     149    out << "HAVE-COMPONENTS " << *prfxs;
     150    return out;
     151 }
     152
     153 ostream &FilterEXCLUDE::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     154    out << "EXCLUDE " << *prfxs;
     155    return out;
     156 }
     157
     158 ostream &FilterRouter::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     159    char buffer[128];
     160
     161    out << int2quad(buffer, ip->get_ipaddr());
     162
     163    return out;
     164 }
     165
     166 ostream &FilterRouterName::print(ostream &out) const {
         /* [<][>][^][v][top][bottom][index][help] */
     167    out << name;
     168    return out;
     169 }
     170

/* [<][>][^][v][top][bottom][index][help] */