| 25 | # by the backend VPN process |
| 26 | # |
| 27 | class UserInputSlot(object): |
| 28 | ## |
| 29 | # Initialize a singe UserInputSlot object |
| 30 | # |
| 31 | # @param session_intf A session interface object to the related VPN session |
| 32 | # @param qtype ClientAttentionType of the request |
| 33 | # @param qgroup ClientAttentionGroup of the request |
| 34 | # @param qid Unique request ID for this (type, group) |
| 35 | # |
| 36 | def __init__(self, session_intf, qtype, qgroup, qid): |
| 37 | self.__session_interf = session_intf |
| 38 | |
| 39 | # Retrieve the request slot |
| 40 | qslot = self.__session_interf.UserInputQueueFetch(qtype.value, |
| 41 | qgroup.value, |
| 42 | qid) |
| 43 | |
| 44 | # Sanity check - ensure we got what we requested |
| 45 | if qtype != ClientAttentionType(qslot[0]) \ |
| 46 | or qgroup != ClientAttentionGroup(qslot[1]) \ |
| 47 | or qid != qslot[2]: |
| 48 | raise RuntimeError('Mismatch in the UserInput queue slot') |
| 49 | |
| 50 | # Parse and save the request information |
| 51 | self.__qtype = qslot[0] |
| 52 | self.__qgroup = qslot[1] |
| 53 | self.__qid = qslot[2] |
| 54 | self.__varname = qslot[3] |
| 55 | self.__label = qslot[4] |
| 56 | self.__mask = qslot[5] |
| 57 | |
| 58 | |
| 59 | def __repr__(self): |
| 60 | return '<UserInputSlot queue_type=%s, queue_group=%s, queue_id=%s, varname="%s", label="%s", masked_input=%s>' % ( |
| 61 | str(ClientAttentionType(self.__qtype)), |
| 62 | str(ClientAttentionGroup(self.__qgroup)), |
| 63 | str(self.__qid), self.__varname, self.__label, |
| 64 | self.__mask and 'True' or 'False') |
| 65 | |
| 66 | |
| 67 | def GetTypeGroup(self): |
| 68 | return (ClientAttentionType(self.__qtype), |
| 69 | ClientAttentionGroup(self.__qgroup)) |
| 70 | |
| 71 | def GetVariableName(self): |
| 72 | return self.__varname |
| 73 | |
| 74 | def GetLabel(self): |
| 75 | return self.__label |
| 76 | |
| 77 | def GetInputMask(self): |
| 78 | return self.__mask |
| 79 | |
| 80 | def ProvideInput(self, value): |
| 81 | self.__session_interf.UserInputProvide(self.__qtype, |
| 82 | self.__qgroup, |
| 83 | self.__qid, |
| 84 | value) |
no outgoing calls
no test coverage detected