a place to store the packing stuff
This commit is contained in:
		
							parent
							
								
									f8401c1568
								
							
						
					
					
						commit
						d601f44dd9
					
				
							
								
								
									
										25
									
								
								dns.pack.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								dns.pack.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| (function (exports) { | ||||
| 'use strict'; | ||||
| 
 | ||||
| var pdns = module.exports.DNS_PACK = function () { | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| pdns.packHeader = function(h) { | ||||
|   var val = 0; | ||||
| 
 | ||||
|   val += (h.qr     << 15) & 0x8000; | ||||
|   val += (h.opcode << 11) & 0x7800; | ||||
|   val += (h.aa     << 10) &  0x400; | ||||
|   val += (h.tc     <<  9) &  0x200; | ||||
|   val += (h.rd     <<  8) &  0x100; | ||||
|   val += (h.ra     <<  7) &   0x80; | ||||
|   val += (h.res1   <<  6) &   0x40; | ||||
|   val += (h.res2   <<  5) &   0x20; | ||||
|   val += (h.res3   <<  4) &   0x10; | ||||
|   val += h.rcode          &    0xF; | ||||
| 
 | ||||
|   return val; | ||||
| }; | ||||
| 
 | ||||
| }('undefined' !== typeof window ? window : exports)); | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user