nmsg  0.9.0
encode.c
1 /* encode nmsg message module */
2 
3 /*
4  * Copyright (c) 2011 by Farsight Security, Inc.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 /* Import. */
20 
21 #include "encode.pb-c.h"
22 
23 /* Data. */
24 
25 struct nmsg_msgmod_field encode_fields[] = {
26  {
28  .name = "type",
30  },
31  {
32  .type = nmsg_msgmod_ft_bytes,
33  .name = "payload",
35  },
36  NMSG_MSGMOD_FIELD_END
37 };
38 
39 /* Export. */
40 
41 struct nmsg_msgmod_plugin nmsg_msgmod_ctx = {
42  NMSG_MSGMOD_REQUIRED_INIT,
43  .vendor = NMSG_VENDOR_BASE,
44  .msgtype = { NMSG_VENDOR_BASE_ENCODE_ID, NMSG_VENDOR_BASE_ENCODE_NAME },
45 
46  .pbdescr = &nmsg__base__encode__descriptor,
47  .fields = encode_fields
48 };
Structure exported by message modules to implement a new message type.
Protobuf enum.
Definition: msgmod.h:75
Protobuf byte array.
Definition: msgmod.h:78
Structure mapping protocol buffer schema fields to nmsg_msgmod_field_type values for "transparent" mo...
nmsg_msgmod_field_type type
Intended (nmsg) type of this protobuf field.
#define NMSG_MSGMOD_FIELD_REQUIRED
field is required
Definition: msgmod.h:124