@@ -3103,6 +3103,39 @@ class FilterIPAddress {
3103
3103
3104
3104
registerFilterClass ( FilterIPAddress ) ;
3105
3105
3106
+ /******************************************************************************/
3107
+
3108
+ class FilterMessage {
3109
+ static match ( ) {
3110
+ return true ;
3111
+ }
3112
+
3113
+ static compile ( details ) {
3114
+ return [
3115
+ FilterMessage . fid ,
3116
+ encodeURIComponent ( details . optionValues . get ( 'message' ) ) ,
3117
+ ] ;
3118
+ }
3119
+
3120
+ static fromCompiled ( args ) {
3121
+ const msg = args [ 1 ] ;
3122
+ return filterDataAlloc ( args [ 0 ] , bidiTrie . storeString ( msg ) , msg . length ) ;
3123
+ }
3124
+
3125
+ static keyFromArgs ( ) {
3126
+ }
3127
+
3128
+ static logData ( idata , details ) {
3129
+ const msg = bidiTrie . extractString (
3130
+ filterData [ idata + 1 ] ,
3131
+ filterData [ idata + 2 ]
3132
+ ) ;
3133
+ details . options . push ( `message=${ decodeURIComponent ( msg ) } ` ) ;
3134
+ }
3135
+ }
3136
+
3137
+ registerFilterClass ( FilterMessage ) ;
3138
+
3106
3139
/******************************************************************************/
3107
3140
/******************************************************************************/
3108
3141
@@ -3578,6 +3611,10 @@ class FilterCompiler {
3578
3611
this . optionValues . set ( 'ipaddress' , parser . getNetOptionValue ( id ) || '' ) ;
3579
3612
this . optionUnitBits |= IPADDRESS_BIT ;
3580
3613
break ;
3614
+ case sfp . NODE_TYPE_NET_OPTION_NAME_MESSAGE :
3615
+ this . optionValues . set ( 'message' , parser . getNetOptionValue ( id ) ) ;
3616
+ this . optionUnitBits |= MESSAGE_BIT ;
3617
+ break ;
3581
3618
case sfp . NODE_TYPE_NET_OPTION_NAME_METHOD :
3582
3619
this . processMethodOption ( parser . getNetOptionValue ( id ) ) ;
3583
3620
this . optionUnitBits |= METHOD_BIT ;
@@ -3699,6 +3736,7 @@ class FilterCompiler {
3699
3736
case sfp . NODE_TYPE_NET_OPTION_NAME_FROM :
3700
3737
case sfp . NODE_TYPE_NET_OPTION_NAME_HEADER :
3701
3738
case sfp . NODE_TYPE_NET_OPTION_NAME_IPADDRESS :
3739
+ case sfp . NODE_TYPE_NET_OPTION_NAME_MESSAGE :
3702
3740
case sfp . NODE_TYPE_NET_OPTION_NAME_METHOD :
3703
3741
case sfp . NODE_TYPE_NET_OPTION_NAME_PERMISSIONS :
3704
3742
case sfp . NODE_TYPE_NET_OPTION_NAME_REDIRECT :
@@ -4081,6 +4119,11 @@ class FilterCompiler {
4081
4119
this . action |= HEADERS_REALM ;
4082
4120
}
4083
4121
4122
+ // Message
4123
+ if ( ( this . optionUnitBits & MESSAGE_BIT ) !== 0 ) {
4124
+ units . push ( FilterMessage . compile ( this ) ) ;
4125
+ }
4126
+
4084
4127
// Important
4085
4128
//
4086
4129
// IMPORTANT: must always appear at the end of the sequence, so as to
@@ -4175,16 +4218,17 @@ class FilterCompiler {
4175
4218
}
4176
4219
4177
4220
// These are to quickly test whether a filter is composite
4178
- const FROM_BIT = 0b0000000001 ;
4179
- const TO_BIT = 0b0000000010 ;
4180
- const DENYALLOW_BIT = 0b0000000100 ;
4181
- const HEADER_BIT = 0b0000001000 ;
4182
- const STRICT_PARTY_BIT = 0b0000010000 ;
4183
- const MODIFY_BIT = 0b0000100000 ;
4184
- const NOT_TYPE_BIT = 0b0001000000 ;
4185
- const IMPORTANT_BIT = 0b0010000000 ;
4186
- const METHOD_BIT = 0b0100000000 ;
4187
- const IPADDRESS_BIT = 0b1000000000 ;
4221
+ const FROM_BIT = 0b00000000001 ;
4222
+ const TO_BIT = 0b00000000010 ;
4223
+ const DENYALLOW_BIT = 0b00000000100 ;
4224
+ const HEADER_BIT = 0b00000001000 ;
4225
+ const STRICT_PARTY_BIT = 0b00000010000 ;
4226
+ const MODIFY_BIT = 0b00000100000 ;
4227
+ const NOT_TYPE_BIT = 0b00001000000 ;
4228
+ const IMPORTANT_BIT = 0b00010000000 ;
4229
+ const METHOD_BIT = 0b00100000000 ;
4230
+ const IPADDRESS_BIT = 0b01000000000 ;
4231
+ const MESSAGE_BIT = 0b10000000000
4188
4232
4189
4233
FilterCompiler . prototype . FILTER_OK = 0 ;
4190
4234
FilterCompiler . prototype . FILTER_INVALID = 1 ;
0 commit comments