ASN.1 decoding of TCAP GSM messages - gsm

I'm trying to decode the TCAP GSM messages and wanted to undertand few things on the ASN.1 struct for few of the elements.
Wanted to understand what does the values in the rectangle brace [] indicate? (shown highlighted in the image above).
Here is the link to the ETS standard which I'm using to extract this info.
look page at 773 for more details.
Any help in making me understand the same is aprreciated.

It's a TAG number. You can read more about encoding of a TAG value here.
If you look at the insertSubscriberData structure you have imsi, msisdn and category of the same type (OCTET STRING) and all are optional. TAG number is necessary tool to distinguish what value was encoded because sender will not encode the value if it is null. When the decoder gets binary data and has to reconstruct the insertSubscriberData structure it needs to know if it is reading imsi, msisdn or category. Based on the tag number it knows what part of the structure it is.

While decoding the arguments of MAP sequence, you access the child elements of sequence using the tag values but bear in the mind that they do not have to be sequential, optional tags might not have been set by encoded party.
e.g. sample code using bounty castle
DLSequence sequence = (DLSequence)derTaggedObject.getObject();
for(int i =0; i < sequence.size(); i++){
DERTaggedObject seqElement = (DERTaggedObject)sequence.getObjectAt(i);
switch (seqElement.getTagNo()) {
case MSCRecordType:
TCAP and MAP ASN.1 module definitions can be found on this github page.

Related

How to read DICOM private tags without reading/loading pixel data?

I would like to read DICOM private tags. These private tags are under hexadecimal tag x7fe11001.
I know one of the pydicom configurations that read till pixel data starts (so the memory is not loaded up).
pydicom.dcmread(raw, defer_size="2 MB", stop_before_pixels=True)
But the private tags I am trying to read are after the pixel data. So I am ending loading complete file in memory which is not optimal. What are the other ways to read it in an optimal way?
I know there is a config param for the above method, called specific_tags. But I could not find any examples of how to use it.
Any suggestions to read DICOM metadata without loading pixel data into memory would be awesome.
You are right, specific_tags is the correct way to do this:
ds = pydicom.dcmread(raw, specific_tags=[Tag(0x7fe1, 0x1001)]
In this case, ds shall contain only your private tag and the Specific Character Set tag (which is always read).
As DICOM is a sequential format, the other tags still have to be skipped over one by one, but their value is not read.
Note that you can put any number of tags into the specific_tags argument.

What is the meaning of ngx_http_request_s::exten

I want to know the meaning of the exten, which is one member of the structure ngx_http_request_t, also, ngx_http_set_exten hopes to be excavated.
I believe that it means file extension, being the part of the final path element that follows a period. It is used to lookup the MIME type in the types data structure, to be used in the response.
Relevant code is here. Line 1701.

function with .DATA how to convert to byte array

Sorry for the Noob Question.
I have a library - RFM69 - https://github.com/LowPowerLab/RFM69
This provides the output as .DATA this appears to be a built in type?
Second I am trying send .DATA as a byte array but don't know what type it is in the first place. How can I find out.
Open the repository on GitHub. https://github.com/LowPowerLab/RFM69
Use the search field in the upper right ( with the in repository option) and search for ".DATA"
This will give you any file that contains it. Within seconds you'll find out that DATA is a member of the class RFM69 which is defined in the file RFM69.h
You got the full source code. All you have to do is search, read and understand parts of it to get any answer you need.
https://github.com/LowPowerLab/RFM69/blob/master/RFM69.h
static volatile uint8_t DATA[RF69_MAX_DATA_LEN]; // recv/xmit buf, including header & crc bytes
I'll leave the rest to you.

Servlet stripping parameter values because of # character

My URL is http://175.24.2.166/download?a=TOP#0;ONE=1;TWO2.
How should I encode the parameter so that when I print the parameter in the Servlet, I get the value in its entirety? Currently when I print the value by using request.getParameter("a") I get the output as TOP instead of TOP#0;ONE=1;TWO2.
You should encode it like this http://175.24.2.166/download?a=TOP%230%3BONE%3D1%3BTWO2 . There are a lot of the encoders in Java, you can try to use URLEncoder or some online encoders for experements
This is known as the "fragment identifier".
as mentioned in wiki
The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document. It is typically used to identify a portion of that document.
the part after the # is info for the client. Put everything your client needs here.
you need to encode your query string.
you can use encodeURIComponent() function in JavaScript encodes a URI component.This function encodes special characters.

What’s the difference between Response.Write() and Response.Output.Write()?

What’s the difference between Response.Write() and Response.Output.Write()?
There is effectively no difference, although Response.Output.Write() provides more overloads which can allow you to pass different parameters. Scott Hansleman covers it in depth.
They both write to the output stream using a TextWriter (not directly to a Stream), however using HttpContext.Response.Output.Write offers more overloads (17 in Framework 2.0, including formatting options) than HttpContext.Response.Write (only 4 with no formatting options).
The HttpResponse type does not allow direct 'set' access to its output stream.
Nothing really.
But. Response.Write takes the stream in the Response.Output property. You could set another Output stream, and in that way instead of writing back to the client, maybe write to a file or something crazy. So thats there relation.
Response.Output.Write(): It is used to display any type of data like int, date, string etc. i.e. It displays the formatted output.
Response.Write(): To display only string type of data i.e. It's can't display formatted output().
To display formatted output from Response.Write() you can write:
Response.Write(String.Format(" ",___));

Resources