## modules/rpsl/peer.y

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

## FUNCTIONS

This source file includes following functions.

1. yyparse
2. peererror

       1 %{
       2 /*
       3   filename: peer.y
       4
       5   description:
       6     Defines the grammar for an RPSL peer attribute.
       7
       8   notes:
       9     Defines tokens for the associated lexer, peer.l.
      10 */
      11
      12 /******************
      13   Copyright (c) 2002                                        RIPE NCC
      14
      15   All Rights Reserved
      16
      17   Permission to use, copy, modify, and distribute this software and its
      18   documentation for any purpose and without fee is hereby granted,
      19   provided that the above copyright notice appear in all copies and that
      20   both that copyright notice and this permission notice appear in
      21   supporting documentation, and that the name of the author not be
      22   used in advertising or publicity pertaining to distribution of the
      23   software without specific, written prior permission.
      24
      25   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
      26   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
      27   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
      28   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
      29   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      30   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      31   ***************************************/
      32
      33 #include <stdlib.h>
      34
      35 int yyerror(const char *s);
      36 %}
      37
      38 %union {
      39     char *sval;
      40 }
      41
      42 %token TKN_SIMPLE_PROTOCOL TKN_BGP4
      43 %token TKN_IPV4 TKN_RTRSNAME TKN_PRNGNAME
      44 %token TKN_ASNO TKN_SMALLINT
      45 %token KEYW_ASNO KEYW_FLAP_DAMP
      46 %token <sval> TKN_DNS
      47 %type <sval> domain_name
      48
      49 %%
         /* [<][>][^][v][top][bottom][index][help] */
      50
      51 peer: TKN_SIMPLE_PROTOCOL TKN_IPV4
      52 | TKN_SIMPLE_PROTOCOL domain_name {
      53     if (strlen($2) > 255) {
      54         syntax_error("Domain name \"%s\" is longer than 255 characters", $2);
      55     }
      56 }
      57 | TKN_SIMPLE_PROTOCOL TKN_RTRSNAME
      58 | TKN_SIMPLE_PROTOCOL TKN_PRNGNAME
      59 | TKN_BGP4 TKN_IPV4 bgp_opt
      60 | TKN_BGP4 domain_name bgp_opt {
      61     if (strlen($2) > 255) {
      62         syntax_error("Domain name \"%s\" is longer than 255 characters", $2);
      63     }
      64 }
      65 | TKN_BGP4 TKN_RTRSNAME bgp_opt
      66 | TKN_BGP4 TKN_PRNGNAME bgp_opt
      67 ;
      68
      69 domain_name: TKN_DNS
      70 | domain_name '.' TKN_DNS
      71 ;
      72
      73 bgp_opt: KEYW_ASNO '(' TKN_ASNO ')'
      74 | flap_damp KEYW_ASNO '(' TKN_ASNO ')'
      75 | KEYW_ASNO '(' TKN_ASNO ')' flap_damp
      76 ;
      77
      78 flap_damp: KEYW_FLAP_DAMP '(' ')'
      79 | KEYW_FLAP_DAMP '(' TKN_SMALLINT ','
      80                      TKN_SMALLINT ','
      81                      TKN_SMALLINT ','
      82                      TKN_SMALLINT ','
      83                      TKN_SMALLINT ','
      84                      TKN_SMALLINT ')'
      85 ;
      86
      87
      88 %%
      89
      90 #undef peererror
      91 #undef yyerror
      92
      93 int
      94 peererror (const char *s)
         /* [<][>][^][v][top][bottom][index][help] */
      95 {
      96     yyerror(s);
      97     return 0;
      98 }
      99

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