~ubuntu-branches/ubuntu/raring/exabgp/raring

« back to all changes in this revision

Viewing changes to lib/exabgp/bgp/message/update/attribute/nexthop.py

  • Committer: Package Import Robot
  • Author(s): Henry-Nicolas Tourneur
  • Date: 2013-01-02 11:42:00 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20130102114200-heowva4yrqiiukc5
Tags: 3.1.1-1

* New upstream release
* Closes: #687134 debconf abuse, notice of software behavior take places under
  NEWS.Debian, not in a debconf screen, information moved accordingly.
* Closes: #693338 Japanese translation removed since debconf template is out.
* Closes: #697178 Russian translation removed since debconf template is out.
* Closes: #689533 UCF-based conf added. 
  No more manual changes to exabgp.env, thanks to Federico Ceratto.
          

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
Created by Thomas Mangin on 2009-11-05.
6
6
Copyright (c) 2009-2012 Exa Networks. All rights reserved.
7
7
"""
 
8
from struct import pack
8
9
 
9
10
from exabgp.protocol.ip.inet import Inet
10
11
from exabgp.bgp.message.update.attribute.id import AttributeID
12
13
 
13
14
# =================================================================== NextHop (3)
14
15
 
 
16
def cachedNextHop (afi,safi,packed):
 
17
        cache = pack('HB%ss' % len(packed),afi,safi,packed)
 
18
        if cache in NextHop.cache:
 
19
                return NextHop.cache[cache]
 
20
        instance = NextHop(afi,safi,packed)
 
21
        if NextHop.caching:
 
22
                NextHop.cache[cache] = instance
 
23
        return instance
 
24
 
15
25
class NextHop (Attribute,Inet):
16
26
        ID = AttributeID.NEXT_HOP
17
27
        FLAG = Flag.TRANSITIVE
18
28
        MULTIPLE = False
19
29
 
 
30
        cache = {}
 
31
        caching = False
 
32
 
20
33
        # Take an IP as value
21
34
        def __init__ (self,afi,safi,packed):
22
35
                Inet.__init__(self,afi,safi,packed)