File: MessageFilter.cs

package info (click to toggle)
aircrack-ng 1%3A1.6%2Bgit20210130.91820bc-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 19,056 kB
  • sloc: ansic: 67,045; cs: 5,392; sh: 3,773; python: 2,565; pascal: 1,074; asm: 570; makefile: 253; cpp: 46
file content (58 lines) | stat: -rw-r--r-- 1,390 bytes parent folder | download | duplicates (19)
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
50
51
52
53
54
55
56
57
58
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details

using System;

namespace NDesk.DBus
{
	class MessageFilter
	{
		//this should probably be made to use HeaderField or similar
		//this class is not generalized yet

		public static string MessageTypeToString (MessageType mtype)
		{
			switch (mtype)
			{
				case MessageType.MethodCall:
					return "method_call";
				case MessageType.MethodReturn:
					return "method_return";
				case MessageType.Error:
					return "error";
				case MessageType.Signal:
					return "signal";
				case MessageType.Invalid:
					return "invalid";
				default:
					throw new Exception ("Bad MessageType: " + mtype);
			}
		}

		public static MessageType StringToMessageType (string text)
		{
			switch (text)
			{
				case "method_call":
					return MessageType.MethodCall;
				case "method_return":
					return MessageType.MethodReturn;
				case "error":
					return MessageType.Error;
				case "signal":
					return MessageType.Signal;
				case "invalid":
					return MessageType.Invalid;
				default:
					throw new Exception ("Bad MessageType: " + text);
			}
		}

		//TODO: remove this -- left here for the benefit of the monitor tool for now
		public static string CreateMatchRule (MessageType mtype)
		{
			return "type='" + MessageTypeToString (mtype) + "'";
		}
	}
}