Skip to content

Commit

Permalink
Making sending BYTES plugin using xdr_opaque an option so that it wor…
Browse files Browse the repository at this point in the history
…ks with old client.
  • Loading branch information
jholloc committed Dec 13, 2024
1 parent 3939176 commit e59c0a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion source/plugins/bytes/bytesPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ int BytesPlugin::read(IDAM_PLUGIN_INTERFACE* plugin_interface)
const char* checksum = nullptr;
FIND_STRING_VALUE(plugin_interface->request_data->nameValueList, checksum);

bool opaque = findValue(&plugin_interface->request_data->nameValueList, "opaque");

char tmp_path[MAXPATH];
StringCopy(tmp_path, path, MAXPATH);
UDA_LOG(UDA_LOG_DEBUG, "expand_environment_variables! \n");
Expand Down Expand Up @@ -287,7 +289,7 @@ int BytesPlugin::read(IDAM_PLUGIN_INTERFACE* plugin_interface)
return err;
}

return readBytes(file, data_block, offset, max_bytes, checksum);
return readBytes(file, data_block, offset, max_bytes, checksum, opaque);
}

int BytesPlugin::size(IDAM_PLUGIN_INTERFACE* plugin_interface)
Expand Down
8 changes: 6 additions & 2 deletions source/plugins/bytes/readBytesNonOptimally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define BYTE_FILE_MD5DIFF 100007
#define BYTE_FILE_READ_ERROR 100008

int readBytes(FILE* fh, DATA_BLOCK* data_block, int offset, int max_bytes, const std::string& checksum)
int readBytes(FILE* fh, DATA_BLOCK* data_block, int offset, int max_bytes, const std::string& checksum, bool opaque)
{
int err = 0;

Expand Down Expand Up @@ -125,7 +125,11 @@ int readBytes(FILE* fh, DATA_BLOCK* data_block, int offset, int max_bytes, const
data_block->dims[0].method = 0;

data_block->order = -1; // No Dimensions
data_block->data_type = UDA_TYPE_OPAQUE; // pass as raw unmodified bytes
if (opaque) {
data_block->data_type = UDA_TYPE_OPAQUE; // pass as raw unmodified bytes
} else {
data_block->data_type = UDA_TYPE_CHAR;
}

return err;
}
2 changes: 1 addition & 1 deletion source/plugins/bytes/readBytesNonOptimally.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#include <clientserver/udaStructs.h>

int readBytes(FILE* file, DATA_BLOCK* data_block, int offset, int max_bytes, const std::string& checksum);
int readBytes(FILE* file, DATA_BLOCK* data_block, int offset, int max_bytes, const std::string& checksum, bool opaque);

0 comments on commit e59c0a0

Please sign in to comment.