コード例 #1
0
    def __init__(self, config, name, params, configdata):

        config_sections = config_base.get_sections(configdata)

        self.items = OrderedDict()
        self.request_elems = []
        self.response_elems = []
        self.messagetype = params[0]
        self.request_value_count = 0
        self.reply_value_count = 0

        # populate request and reply data

        fields = {
            "messageType": (config_base.read_string, True),
            "workerMessageType": (config_base.read_string, True)
        }

        for n, l in config_sections["main"][1]:
            try:
                what = l.split("=")[0]
                which = l.split("=")[1]
                self.items[what] = config_base.read_config(fields, what, which)
            except Exception, e:
                raise ParsingError("Config line %s : invalid item : %s " %
                                   (n, str(e)))
コード例 #2
0
    def __init__(self, data):

        okparams = [["translatedXML"]]
        fields = {
            "messageID": (config_base.read_message_id, True),
            "replymessageID": (config_base.read_message_id, True)
        }

        self.config = OrderedDict()
        self.messages = []
        params, block = data

        config_base.myassert(
            len(params) == len(okparams), "Invalid message definition")
        config_base.myassert(params[0] in okparams[0],
                             "Invalid message parameter " + params[0])
        self.type = params[0]

        for n, l in block:
            try:
                what = l.split("=")[0]
                which = l.split("=")[1]
                if what == "message":
                    self.messages.append(which)
                else:
                    self.config[what] = config_base.read_config(
                        fields, what, which)
            except Exception, e:
                raise ParsingError("Config line %s : invalid item : %s " %
                                   (n, str(e)))
コード例 #3
0
    def __init__(self, data):

        self.config = OrderedDict()
        params, block = data

        okparams = [["terminated", "http"]]
        fields = {
            "contentType": (config_base.read_string, False),
            "requestMethod": (config_base.read_string, False),
            "requestURI": (config_base.read_string, False)
        }
        config_base.myassert(
            len(params) == len(okparams), "Invalid encapsulation definition")
        config_base.myassert(params[0] in okparams[0],
                             "Invalid encapsulation parameter " + params[0])
        self.config["type"] = params[0]

        fields = {}

        for n, l in block:
            try:
                what = l.split("=")[0]
                which = l.split("=")[1]
                self.config[what] = config_base.read_config(
                    fields, what, which)
            except Exception, e:
                raise ParsingError("Config line %s : invalid item : %s " %
                                   (n, str(e)))
コード例 #4
0
    def __init__(self, data):

        okparams = [["raw", "tls"]]
        fields = {"port": (config_base.read_string, True)}

        self.config = OrderedDict()
        params, block = data

        config_base.myassert(
            len(params) == len(okparams), "Invalid transport definition")
        config_base.myassert(params[0] in okparams[0],
                             "Invalid worker parameter " + params[0])
        self.config["type"] = params[0]

        for n, l in block:
            try:
                what = l.split("=")[0]
                which = l.split("=")[1]
                self.config[what] = config_base.read_config(
                    fields, what, which)
            except Exception, e:
                raise ParsingError("Config line %s : invalid item : %s " %
                                   (n, str(e)))
コード例 #5
0
    def __init__(self, data):

        self.config = OrderedDict()
        _, block = data

        fields = {
            "command": (config_base.read_string, True),
            "remoteserver": (config_base.read_string, True),
            "remoteport": (config_base.read_string, True),
            "fromdelimiter": (config_base.read_delimiter, True),
            "todelimiter": (config_base.read_delimiter, True),
            "fromterminator": (config_base.read_delimiter, True),
            "toterminator": (config_base.read_delimiter, True)
        }

        for n, l in block:
            try:
                what = l.split("=")[0]
                which = l.split("=")[1]
                self.config[what] = config_base.read_config(
                    fields, what, which)
            except Exception, e:
                raise ParsingError("Config line %s : invalid item : %s " %
                                   (n, str(e)))