Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

# The main message class that the AuthChannel operate on 

class AuthenticatedMessage(object): 

 

    def __init__(self, sender, msg, session=None): 

        self.sender = sender 

        self.msg = msg 

        self.session = session 

 

    def __str__(self): 

        return self.msg 

 

    def __int__(self): 

        return int(self.msg) 

 

    def __float__(self): 

        return float(self.msg) 

 

 

class NutsError(Exception): 

    """ General NUTS-related failure. """ 

 

 

class NutsConnectionError(NutsError): 

    """ Something failed in the communication. """ 

 

 

class NutsMessageTooLarge(NutsError): 

    """ Tried to send message larger than what's supported by the underlying 

    transport. 

    """ 

 

 

class NutsInvalidState(NutsError): 

    """ Tried to perform an action which is unavilable in the current 

    state. """ 

 

 

 

 

from .channels import ( 

    AuthChannel, 

    UDPAuthChannel, 

) 

 

from .enums import ( 

    ClientState, 

    ServerState, 

    Message, 

)