blob: 98d2602a73a158ea964db9c62f13231a440b6d3d [file] [log] [blame]
Vitaly Bukab5c12da2016-10-19 13:12:41 -07001// Copyright 2016 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef LIBPROTOBUG_MUTATOR_PROTOBUG_MUTATOR_H
16#define LIBPROTOBUG_MUTATOR_PROTOBUG_MUTATOR_H
17
Vitaly Buka00b61072016-10-19 16:22:51 -070018#include <stdint.h>
19
Vitaly Bukab5c12da2016-10-19 13:12:41 -070020class Message;
Vitaly Buka00b61072016-10-19 16:22:51 -070021class FieldDescriptor;
22class EnumValueDescriptor;
23
Vitaly Bukab5c12da2016-10-19 13:12:41 -070024
25class ProtobufMutator {
26 public:
Vitaly Buka00b61072016-10-19 16:22:51 -070027 ProtobufMutator(uint32_t seed);
28 virtual ~ProtobufMutator();
29
Vitaly Bukab5c12da2016-10-19 13:12:41 -070030 bool Mutate(Message* proto);
31 bool CrossOver(const Message& with, Message* proto);
32
Vitaly Buka00b61072016-10-19 16:22:51 -070033 virtual bool MutateField(const FieldDescriptor& field, int32_t* value);
34 virtual bool MutateField(const FieldDescriptor& field, int64_t* value);
35 virtual bool MutateField(const FieldDescriptor& field, uint32_t* value);
36 virtual bool MutateField(const FieldDescriptor& field, uint64_t* value);
37 virtual bool MutateField(const FieldDescriptor& field, double* value);
38 virtual bool MutateField(const FieldDescriptor& field, float* value);
39 virtual bool MutateField(const FieldDescriptor& field, bool* value);
40 virtual bool MutateField(const FieldDescriptor& field, const EnumValueDescriptor** value);
41 virtual bool MutateField(const FieldDescriptor& field, Message* value);
42
Vitaly Bukab5c12da2016-10-19 13:12:41 -070043 private:
44};
45
46#endif // LIBPROTOBUG_MUTATOR_PROTOBUG_MUTATOR_H