/*## (c) SECURITY EXPLORATIONS    2018 poland                                #*/
/*##     http://www.security-explorations.com                                #*/

/* THIS SOFTWARE IS PROTECTED BY DOMESTIC AND INTERNATIONAL COPYRIGHT LAWS    */
/* UNAUTHORISED COPYING OF THIS SOFTWARE IN EITHER SOURCE OR BINARY FORM IS   */
/* EXPRESSLY FORBIDDEN. ANY USE, INCLUDING THE REPRODUCTION, MODIFICATION,    */
/* DISTRIBUTION, TRANSMISSION, RE-PUBLICATION, STORAGE OR DISPLAY OF ANY      */
/* PART OF THE SOFTWARE, FOR COMMERCIAL OR ANY OTHER PURPOSES REQUIRES A      */
/* VALID LICENSE FROM THE COPYRIGHT HOLDER.                                   */

/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS    */
/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,*/
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    */
/* SECURITY EXPLORATIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF  */
/* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE     */
/* SOFTWARE.                                                                  */

import java.lang.*;

public class SCFilter {
 public static final int ST_WRITE_REQ_HDR     = 0x01;
 public static final int ST_READ_REQ_CMD      = 0x02;
 public static final int ST_WRITE_REQ_BODY    = 0x04;
 public static final int ST_READ_RESP_CODE1   = 0x08;
 public static final int ST_READ_RESP_CODE2   = 0x10;
 public static final int ST_WRITE_RESP_REQ    = 0x20;
 public static final int ST_READ_RESP_REQ_CMD = 0x40;
 public static final int ST_READ_RESP_BODY    = 0x80;

 public static final int ST_READ_ALL          = ST_READ_REQ_CMD|ST_READ_RESP_CODE1|ST_READ_RESP_CODE2|ST_READ_RESP_REQ_CMD|ST_READ_RESP_BODY;
 public static final int ST_WRITE_ALL         = ST_WRITE_REQ_HDR|ST_WRITE_REQ_BODY|ST_WRITE_RESP_REQ;

 public static final int ST_ALL               = ST_READ_ALL|ST_WRITE_ALL;

 String name;
 boolean enabled;
 int actionmask;

 public SCFilter(String s,int mask) {
  name=s;
  actionmask=mask; 
  enabled=false;
 }

 public void enable() {
  enabled=true;
 }

 public void disable() {
  enabled=false;
 }

 public int actionmask() {
  return actionmask;
 }

 public boolean enabled() {
  return enabled;
 }

 public String name() {
  return name;
 }

 public void change_res(int ptr,int val) {
  Memory.write_dword(ptr,val);
 }

 public boolean match(int prefix,int state,int cmd,int ptr,int buf,int size) {
  return true;
 }

 public boolean action(int prefix,int state,int cmd,int ptr,int buf,int size) {
  return true;
 }

}
