/* This file was generated by upbc (the upb compiler) from the input
 * file:
 *
 *     src/proto/grpc/auth/v1/authz_policy.proto
 *
 * Do not edit -- your changes will be discarded when the file is
 * regenerated. */

#ifndef SRC_PROTO_GRPC_AUTH_V1_AUTHZ_POLICY_PROTO_UPB_H_
#define SRC_PROTO_GRPC_AUTH_V1_AUTHZ_POLICY_PROTO_UPB_H_

#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/decode_fast.h"
#include "upb/encode.h"

#include "upb/port_def.inc"

#ifdef __cplusplus
extern "C" {
#endif

struct grpc_auth_v1_Peer;
struct grpc_auth_v1_Header;
struct grpc_auth_v1_Request;
struct grpc_auth_v1_Rule;
struct grpc_auth_v1_AuthorizationPolicy;
typedef struct grpc_auth_v1_Peer grpc_auth_v1_Peer;
typedef struct grpc_auth_v1_Header grpc_auth_v1_Header;
typedef struct grpc_auth_v1_Request grpc_auth_v1_Request;
typedef struct grpc_auth_v1_Rule grpc_auth_v1_Rule;
typedef struct grpc_auth_v1_AuthorizationPolicy grpc_auth_v1_AuthorizationPolicy;
extern const upb_msglayout grpc_auth_v1_Peer_msginit;
extern const upb_msglayout grpc_auth_v1_Header_msginit;
extern const upb_msglayout grpc_auth_v1_Request_msginit;
extern const upb_msglayout grpc_auth_v1_Rule_msginit;
extern const upb_msglayout grpc_auth_v1_AuthorizationPolicy_msginit;


/* grpc.auth.v1.Peer */

UPB_INLINE grpc_auth_v1_Peer *grpc_auth_v1_Peer_new(upb_arena *arena) {
  return (grpc_auth_v1_Peer *)_upb_msg_new(&grpc_auth_v1_Peer_msginit, arena);
}
UPB_INLINE grpc_auth_v1_Peer *grpc_auth_v1_Peer_parse(const char *buf, size_t size,
                        upb_arena *arena) {
  grpc_auth_v1_Peer *ret = grpc_auth_v1_Peer_new(arena);
  return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Peer_msginit, arena)) ? ret : NULL;
}
UPB_INLINE grpc_auth_v1_Peer *grpc_auth_v1_Peer_parse_ex(const char *buf, size_t size,
                           upb_arena *arena, int options) {
  grpc_auth_v1_Peer *ret = grpc_auth_v1_Peer_new(arena);
  return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Peer_msginit, arena, options))
      ? ret : NULL;
}
UPB_INLINE char *grpc_auth_v1_Peer_serialize(const grpc_auth_v1_Peer *msg, upb_arena *arena, size_t *len) {
  return upb_encode(msg, &grpc_auth_v1_Peer_msginit, arena, len);
}

UPB_INLINE upb_strview const* grpc_auth_v1_Peer_principals(const grpc_auth_v1_Peer *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }

UPB_INLINE upb_strview* grpc_auth_v1_Peer_mutable_principals(grpc_auth_v1_Peer *msg, size_t *len) {
  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
}
UPB_INLINE upb_strview* grpc_auth_v1_Peer_resize_principals(grpc_auth_v1_Peer *msg, size_t len, upb_arena *arena) {
  return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(3, 4), arena);
}
UPB_INLINE bool grpc_auth_v1_Peer_add_principals(grpc_auth_v1_Peer *msg, upb_strview val, upb_arena *arena) {
  return _upb_array_append_accessor2(msg, UPB_SIZE(0, 0), UPB_SIZE(3, 4), &val,
      arena);
}

/* grpc.auth.v1.Header */

UPB_INLINE grpc_auth_v1_Header *grpc_auth_v1_Header_new(upb_arena *arena) {
  return (grpc_auth_v1_Header *)_upb_msg_new(&grpc_auth_v1_Header_msginit, arena);
}
UPB_INLINE grpc_auth_v1_Header *grpc_auth_v1_Header_parse(const char *buf, size_t size,
                        upb_arena *arena) {
  grpc_auth_v1_Header *ret = grpc_auth_v1_Header_new(arena);
  return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Header_msginit, arena)) ? ret : NULL;
}
UPB_INLINE grpc_auth_v1_Header *grpc_auth_v1_Header_parse_ex(const char *buf, size_t size,
                           upb_arena *arena, int options) {
  grpc_auth_v1_Header *ret = grpc_auth_v1_Header_new(arena);
  return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Header_msginit, arena, options))
      ? ret : NULL;
}
UPB_INLINE char *grpc_auth_v1_Header_serialize(const grpc_auth_v1_Header *msg, upb_arena *arena, size_t *len) {
  return upb_encode(msg, &grpc_auth_v1_Header_msginit, arena, len);
}

UPB_INLINE upb_strview grpc_auth_v1_Header_key(const grpc_auth_v1_Header *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); }
UPB_INLINE upb_strview const* grpc_auth_v1_Header_values(const grpc_auth_v1_Header *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); }

UPB_INLINE void grpc_auth_v1_Header_set_key(grpc_auth_v1_Header *msg, upb_strview value) {
  *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value;
}
UPB_INLINE upb_strview* grpc_auth_v1_Header_mutable_values(grpc_auth_v1_Header *msg, size_t *len) {
  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len);
}
UPB_INLINE upb_strview* grpc_auth_v1_Header_resize_values(grpc_auth_v1_Header *msg, size_t len, upb_arena *arena) {
  return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 16), len, UPB_SIZE(3, 4), arena);
}
UPB_INLINE bool grpc_auth_v1_Header_add_values(grpc_auth_v1_Header *msg, upb_strview val, upb_arena *arena) {
  return _upb_array_append_accessor2(msg, UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val,
      arena);
}

/* grpc.auth.v1.Request */

UPB_INLINE grpc_auth_v1_Request *grpc_auth_v1_Request_new(upb_arena *arena) {
  return (grpc_auth_v1_Request *)_upb_msg_new(&grpc_auth_v1_Request_msginit, arena);
}
UPB_INLINE grpc_auth_v1_Request *grpc_auth_v1_Request_parse(const char *buf, size_t size,
                        upb_arena *arena) {
  grpc_auth_v1_Request *ret = grpc_auth_v1_Request_new(arena);
  return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Request_msginit, arena)) ? ret : NULL;
}
UPB_INLINE grpc_auth_v1_Request *grpc_auth_v1_Request_parse_ex(const char *buf, size_t size,
                           upb_arena *arena, int options) {
  grpc_auth_v1_Request *ret = grpc_auth_v1_Request_new(arena);
  return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Request_msginit, arena, options))
      ? ret : NULL;
}
UPB_INLINE char *grpc_auth_v1_Request_serialize(const grpc_auth_v1_Request *msg, upb_arena *arena, size_t *len) {
  return upb_encode(msg, &grpc_auth_v1_Request_msginit, arena, len);
}

UPB_INLINE upb_strview const* grpc_auth_v1_Request_paths(const grpc_auth_v1_Request *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
UPB_INLINE bool grpc_auth_v1_Request_has_headers(const grpc_auth_v1_Request *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
UPB_INLINE const grpc_auth_v1_Header* const* grpc_auth_v1_Request_headers(const grpc_auth_v1_Request *msg, size_t *len) { return (const grpc_auth_v1_Header* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }

UPB_INLINE upb_strview* grpc_auth_v1_Request_mutable_paths(grpc_auth_v1_Request *msg, size_t *len) {
  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
}
UPB_INLINE upb_strview* grpc_auth_v1_Request_resize_paths(grpc_auth_v1_Request *msg, size_t len, upb_arena *arena) {
  return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(3, 4), arena);
}
UPB_INLINE bool grpc_auth_v1_Request_add_paths(grpc_auth_v1_Request *msg, upb_strview val, upb_arena *arena) {
  return _upb_array_append_accessor2(msg, UPB_SIZE(0, 0), UPB_SIZE(3, 4), &val,
      arena);
}
UPB_INLINE grpc_auth_v1_Header** grpc_auth_v1_Request_mutable_headers(grpc_auth_v1_Request *msg, size_t *len) {
  return (grpc_auth_v1_Header**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
}
UPB_INLINE grpc_auth_v1_Header** grpc_auth_v1_Request_resize_headers(grpc_auth_v1_Request *msg, size_t len, upb_arena *arena) {
  return (grpc_auth_v1_Header**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
}
UPB_INLINE struct grpc_auth_v1_Header* grpc_auth_v1_Request_add_headers(grpc_auth_v1_Request *msg, upb_arena *arena) {
  struct grpc_auth_v1_Header* sub = (struct grpc_auth_v1_Header*)_upb_msg_new(&grpc_auth_v1_Header_msginit, arena);
  bool ok = _upb_array_append_accessor2(
      msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
  if (!ok) return NULL;
  return sub;
}

/* grpc.auth.v1.Rule */

UPB_INLINE grpc_auth_v1_Rule *grpc_auth_v1_Rule_new(upb_arena *arena) {
  return (grpc_auth_v1_Rule *)_upb_msg_new(&grpc_auth_v1_Rule_msginit, arena);
}
UPB_INLINE grpc_auth_v1_Rule *grpc_auth_v1_Rule_parse(const char *buf, size_t size,
                        upb_arena *arena) {
  grpc_auth_v1_Rule *ret = grpc_auth_v1_Rule_new(arena);
  return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_Rule_msginit, arena)) ? ret : NULL;
}
UPB_INLINE grpc_auth_v1_Rule *grpc_auth_v1_Rule_parse_ex(const char *buf, size_t size,
                           upb_arena *arena, int options) {
  grpc_auth_v1_Rule *ret = grpc_auth_v1_Rule_new(arena);
  return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_Rule_msginit, arena, options))
      ? ret : NULL;
}
UPB_INLINE char *grpc_auth_v1_Rule_serialize(const grpc_auth_v1_Rule *msg, upb_arena *arena, size_t *len) {
  return upb_encode(msg, &grpc_auth_v1_Rule_msginit, arena, len);
}

UPB_INLINE upb_strview grpc_auth_v1_Rule_name(const grpc_auth_v1_Rule *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
UPB_INLINE bool grpc_auth_v1_Rule_has_source(const grpc_auth_v1_Rule *msg) { return _upb_hasbit(msg, 1); }
UPB_INLINE const grpc_auth_v1_Peer* grpc_auth_v1_Rule_source(const grpc_auth_v1_Rule *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const grpc_auth_v1_Peer*); }
UPB_INLINE bool grpc_auth_v1_Rule_has_request(const grpc_auth_v1_Rule *msg) { return _upb_hasbit(msg, 2); }
UPB_INLINE const grpc_auth_v1_Request* grpc_auth_v1_Rule_request(const grpc_auth_v1_Rule *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 32), const grpc_auth_v1_Request*); }

UPB_INLINE void grpc_auth_v1_Rule_set_name(grpc_auth_v1_Rule *msg, upb_strview value) {
  *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
}
UPB_INLINE void grpc_auth_v1_Rule_set_source(grpc_auth_v1_Rule *msg, grpc_auth_v1_Peer* value) {
  _upb_sethas(msg, 1);
  *UPB_PTR_AT(msg, UPB_SIZE(12, 24), grpc_auth_v1_Peer*) = value;
}
UPB_INLINE struct grpc_auth_v1_Peer* grpc_auth_v1_Rule_mutable_source(grpc_auth_v1_Rule *msg, upb_arena *arena) {
  struct grpc_auth_v1_Peer* sub = (struct grpc_auth_v1_Peer*)grpc_auth_v1_Rule_source(msg);
  if (sub == NULL) {
    sub = (struct grpc_auth_v1_Peer*)_upb_msg_new(&grpc_auth_v1_Peer_msginit, arena);
    if (!sub) return NULL;
    grpc_auth_v1_Rule_set_source(msg, sub);
  }
  return sub;
}
UPB_INLINE void grpc_auth_v1_Rule_set_request(grpc_auth_v1_Rule *msg, grpc_auth_v1_Request* value) {
  _upb_sethas(msg, 2);
  *UPB_PTR_AT(msg, UPB_SIZE(16, 32), grpc_auth_v1_Request*) = value;
}
UPB_INLINE struct grpc_auth_v1_Request* grpc_auth_v1_Rule_mutable_request(grpc_auth_v1_Rule *msg, upb_arena *arena) {
  struct grpc_auth_v1_Request* sub = (struct grpc_auth_v1_Request*)grpc_auth_v1_Rule_request(msg);
  if (sub == NULL) {
    sub = (struct grpc_auth_v1_Request*)_upb_msg_new(&grpc_auth_v1_Request_msginit, arena);
    if (!sub) return NULL;
    grpc_auth_v1_Rule_set_request(msg, sub);
  }
  return sub;
}

/* grpc.auth.v1.AuthorizationPolicy */

UPB_INLINE grpc_auth_v1_AuthorizationPolicy *grpc_auth_v1_AuthorizationPolicy_new(upb_arena *arena) {
  return (grpc_auth_v1_AuthorizationPolicy *)_upb_msg_new(&grpc_auth_v1_AuthorizationPolicy_msginit, arena);
}
UPB_INLINE grpc_auth_v1_AuthorizationPolicy *grpc_auth_v1_AuthorizationPolicy_parse(const char *buf, size_t size,
                        upb_arena *arena) {
  grpc_auth_v1_AuthorizationPolicy *ret = grpc_auth_v1_AuthorizationPolicy_new(arena);
  return (ret && upb_decode(buf, size, ret, &grpc_auth_v1_AuthorizationPolicy_msginit, arena)) ? ret : NULL;
}
UPB_INLINE grpc_auth_v1_AuthorizationPolicy *grpc_auth_v1_AuthorizationPolicy_parse_ex(const char *buf, size_t size,
                           upb_arena *arena, int options) {
  grpc_auth_v1_AuthorizationPolicy *ret = grpc_auth_v1_AuthorizationPolicy_new(arena);
  return (ret && _upb_decode(buf, size, ret, &grpc_auth_v1_AuthorizationPolicy_msginit, arena, options))
      ? ret : NULL;
}
UPB_INLINE char *grpc_auth_v1_AuthorizationPolicy_serialize(const grpc_auth_v1_AuthorizationPolicy *msg, upb_arena *arena, size_t *len) {
  return upb_encode(msg, &grpc_auth_v1_AuthorizationPolicy_msginit, arena, len);
}

UPB_INLINE upb_strview grpc_auth_v1_AuthorizationPolicy_name(const grpc_auth_v1_AuthorizationPolicy *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); }
UPB_INLINE bool grpc_auth_v1_AuthorizationPolicy_has_deny_rules(const grpc_auth_v1_AuthorizationPolicy *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(8, 16)); }
UPB_INLINE const grpc_auth_v1_Rule* const* grpc_auth_v1_AuthorizationPolicy_deny_rules(const grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) { return (const grpc_auth_v1_Rule* const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); }
UPB_INLINE bool grpc_auth_v1_AuthorizationPolicy_has_allow_rules(const grpc_auth_v1_AuthorizationPolicy *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(12, 24)); }
UPB_INLINE const grpc_auth_v1_Rule* const* grpc_auth_v1_AuthorizationPolicy_allow_rules(const grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) { return (const grpc_auth_v1_Rule* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); }

UPB_INLINE void grpc_auth_v1_AuthorizationPolicy_set_name(grpc_auth_v1_AuthorizationPolicy *msg, upb_strview value) {
  *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value;
}
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_mutable_deny_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) {
  return (grpc_auth_v1_Rule**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len);
}
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_resize_deny_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t len, upb_arena *arena) {
  return (grpc_auth_v1_Rule**)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 16), len, UPB_SIZE(2, 3), arena);
}
UPB_INLINE struct grpc_auth_v1_Rule* grpc_auth_v1_AuthorizationPolicy_add_deny_rules(grpc_auth_v1_AuthorizationPolicy *msg, upb_arena *arena) {
  struct grpc_auth_v1_Rule* sub = (struct grpc_auth_v1_Rule*)_upb_msg_new(&grpc_auth_v1_Rule_msginit, arena);
  bool ok = _upb_array_append_accessor2(
      msg, UPB_SIZE(8, 16), UPB_SIZE(2, 3), &sub, arena);
  if (!ok) return NULL;
  return sub;
}
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_mutable_allow_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t *len) {
  return (grpc_auth_v1_Rule**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 24), len);
}
UPB_INLINE grpc_auth_v1_Rule** grpc_auth_v1_AuthorizationPolicy_resize_allow_rules(grpc_auth_v1_AuthorizationPolicy *msg, size_t len, upb_arena *arena) {
  return (grpc_auth_v1_Rule**)_upb_array_resize_accessor2(msg, UPB_SIZE(12, 24), len, UPB_SIZE(2, 3), arena);
}
UPB_INLINE struct grpc_auth_v1_Rule* grpc_auth_v1_AuthorizationPolicy_add_allow_rules(grpc_auth_v1_AuthorizationPolicy *msg, upb_arena *arena) {
  struct grpc_auth_v1_Rule* sub = (struct grpc_auth_v1_Rule*)_upb_msg_new(&grpc_auth_v1_Rule_msginit, arena);
  bool ok = _upb_array_append_accessor2(
      msg, UPB_SIZE(12, 24), UPB_SIZE(2, 3), &sub, arena);
  if (!ok) return NULL;
  return sub;
}

#ifdef __cplusplus
}  /* extern "C" */
#endif

#include "upb/port_undef.inc"

#endif  /* SRC_PROTO_GRPC_AUTH_V1_AUTHZ_POLICY_PROTO_UPB_H_ */
