• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "fields/checksum_start_field.h"
18 #include "util.h"
19 
20 const std::string ChecksumStartField::kFieldType = "ChecksumStartField";
21 
ChecksumStartField(std::string name,ParseLocation loc)22 ChecksumStartField::ChecksumStartField(std::string name, ParseLocation loc)
23     : PacketField(name + "_start", loc), started_field_name_(name) {}
24 
GetFieldType() const25 const std::string& ChecksumStartField::GetFieldType() const {
26   return ChecksumStartField::kFieldType;
27 }
28 
GetSize() const29 Size ChecksumStartField::GetSize() const {
30   return Size(0);
31 }
32 
GetDataType() const33 std::string ChecksumStartField::GetDataType() const {
34   return "There's no type for Checksum Start fields";
35 }
36 
GenExtractor(std::ostream &,int,bool) const37 void ChecksumStartField::GenExtractor(std::ostream&, int, bool) const {}
38 
GetGetterFunctionName() const39 std::string ChecksumStartField::GetGetterFunctionName() const {
40   return "";
41 }
42 
GenGetter(std::ostream &,Size,Size) const43 void ChecksumStartField::GenGetter(std::ostream&, Size, Size) const {}
44 
GetBuilderParameterType() const45 std::string ChecksumStartField::GetBuilderParameterType() const {
46   return "";
47 }
48 
HasParameterValidator() const49 bool ChecksumStartField::HasParameterValidator() const {
50   return false;
51 }
52 
GenParameterValidator(std::ostream &) const53 void ChecksumStartField::GenParameterValidator(std::ostream&) const {}
54 
GenInserter(std::ostream &) const55 void ChecksumStartField::GenInserter(std::ostream&) const {
56   ERROR(this) << __func__ << ": This should not be called for checksum start fields";
57 }
58 
GenValidator(std::ostream &) const59 void ChecksumStartField::GenValidator(std::ostream&) const {}
60 
GetStartedFieldName() const61 std::string ChecksumStartField::GetStartedFieldName() const {
62   return started_field_name_;
63 }
64 
GenStringRepresentation(std::ostream &,std::string) const65 void ChecksumStartField::GenStringRepresentation(std::ostream&, std::string) const {
66   // Print nothing for checksum start
67 }
68 
GetRustDataType() const69 std::string ChecksumStartField::GetRustDataType() const {
70   return GetDataType();
71 }
72 
GenRustGetter(std::ostream &,Size,Size) const73 void ChecksumStartField::GenRustGetter(std::ostream&, Size, Size) const {
74 }
75 
GenRustWriter(std::ostream &,Size,Size) const76 void ChecksumStartField::GenRustWriter(std::ostream&, Size, Size) const {}
77